From: Jakub Jelinek Date: Wed, 23 Nov 2016 15:59:25 +0000 (+0100) Subject: re PR c++/71450 (ICE on invalid C++11 code on x86_64-linux-gnu: in tree check: expect... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1b3314ddb15e6e4007035d1f6f823650c9dc70b8;p=gcc.git 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 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 66ea957e1b7..7418b22498b 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2016-11-23 Jakub Jelinek + 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) : Pass false as handle_invisiref_parm_p to cp_genericize_tree. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 6a68de24bbb..8b0a21cb2b2 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -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; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ca673eea1da..6abbd3b4378 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,9 @@ 2016-11-23 Jakub Jelinek + 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. diff --git a/gcc/testsuite/g++.dg/cpp0x/pr71450-1.C b/gcc/testsuite/g++.dg/cpp0x/pr71450-1.C new file mode 100644 index 00000000000..1c686295766 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/pr71450-1.C @@ -0,0 +1,16 @@ +// PR c++/71450 +// { dg-do compile { target c++11 } } + +struct A { A operator+ (A a) { return a; } }; + +template +void foo (T t) +{ + auto x = t + x; // { dg-error "use of 'x' before deduction of 'auto'" } +} + +int +main () +{ + foo (A ()); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/pr71450-2.C b/gcc/testsuite/g++.dg/cpp0x/pr71450-2.C new file mode 100644 index 00000000000..1a7376c85b8 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/pr71450-2.C @@ -0,0 +1,14 @@ +// PR c++/71450 +// { dg-do compile { target c++11 } } + +template +void foo (T t) +{ + auto x = t + x; // { dg-error "use of 'x' before deduction of 'auto'" } +} + +int +main () +{ + foo (1); +}