re PR c++/71450 (ICE on invalid C++11 code on x86_64-linux-gnu: in tree check: expected record_type or union_type or qual_union_type, have template_type_parm in lookup_base, at cp/search.c:203)

PR c++/71450
	* pt.c (tsubst_copy): Return error_mark_node when mark_used
	fails, even when complain & tf_error.

	* g++.dg/cpp0x/pr71450-1.C: New test.
	* g++.dg/cpp0x/pr71450-2.C: New test.

From-SVN: r242767
This commit is contained in:
Jakub Jelinek 2016-11-23 16:59:25 +01:00 committed by Jakub Jelinek
parent e2df23288c
commit 1b3314ddb1
5 changed files with 39 additions and 1 deletions

View File

@ -1,5 +1,9 @@
2016-11-23 Jakub Jelinek <jakub@redhat.com>
PR c++/71450
* pt.c (tsubst_copy): Return error_mark_node when mark_used
fails, even when complain & tf_error.
PR c++/77739
* cp-gimplify.c (cp_gimplify_tree) <case VEC_INIT_EXPR>: Pass
false as handle_invisiref_parm_p to cp_genericize_tree.

View File

@ -14297,7 +14297,7 @@ tsubst_copy (tree t, tree args, tsubst_flags_t complain, tree in_decl)
}
else
r = t;
if (!mark_used (r, complain) && !(complain & tf_error))
if (!mark_used (r, complain))
return error_mark_node;
return r;

View File

@ -1,5 +1,9 @@
2016-11-23 Jakub Jelinek <jakub@redhat.com>
PR c++/71450
* g++.dg/cpp0x/pr71450-1.C: New test.
* g++.dg/cpp0x/pr71450-2.C: New test.
PR c++/77739
* g++.dg/cpp1y/pr77739.C: New test.

View File

@ -0,0 +1,16 @@
// PR c++/71450
// { dg-do compile { target c++11 } }
struct A { A operator+ (A a) { return a; } };
template <class T>
void foo (T t)
{
auto x = t + x; // { dg-error "use of 'x' before deduction of 'auto'" }
}
int
main ()
{
foo (A ());
}

View File

@ -0,0 +1,14 @@
// PR c++/71450
// { dg-do compile { target c++11 } }
template <class T>
void foo (T t)
{
auto x = t + x; // { dg-error "use of 'x' before deduction of 'auto'" }
}
int
main ()
{
foo (1);
}