re PR c++/85028 (ICE on invalid C++ code: in tsubst_default_argument, at cp/pt.c:12340)

/cp
2018-03-28  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/85028
	* pt.c (tsubst_default_argument): Early return if the type of the
	parameter is erroneous.

/testsuite
2018-03-28  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/85028
	* g++.dg/other/default13.C: New.

From-SVN: r258932
This commit is contained in:
Paolo Carlini 2018-03-28 19:21:41 +00:00 committed by Paolo Carlini
parent 0a5c6d78b7
commit 427d369ce1
4 changed files with 25 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2018-03-28 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/85028
* pt.c (tsubst_default_argument): Early return if the type of the
parameter is erroneous.
2018-03-28 Alexandre Oliva <aoliva@redhat.com>
PR c++/84973

View File

@ -12337,6 +12337,9 @@ tsubst_default_argument (tree fn, int parmnum, tree type, tree arg,
tree parmtype = TREE_TYPE (parm);
if (DECL_BY_REFERENCE (parm))
parmtype = TREE_TYPE (parmtype);
if (parmtype == error_mark_node)
return error_mark_node;
gcc_assert (same_type_ignoring_top_level_qualifiers_p (type, parmtype));
tree *slot;

View File

@ -1,3 +1,8 @@
2018-03-28 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/85028
* g++.dg/other/default13.C: New.
2018-03-28 Jakub Jelinek <jakub@redhat.com>
PR target/85095

View File

@ -0,0 +1,11 @@
// PR c++/85028
struct A;
template < typename > struct B
{
B (int, A = A()) : f (0) {} // { dg-error "incomplete type" }
int f;
};
B < int > b (0);