From: Jakub Jelinek Date: Fri, 19 Apr 2019 11:57:23 +0000 (+0200) Subject: re PR c++/90138 (ICE on invalid in contains_struct_check()) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7296c0c537870eea056011c019cfe8ee92ef4a00;p=gcc.git re PR c++/90138 (ICE on invalid in contains_struct_check()) PR c++/90138 * pt.c (process_template_parm): Set decl to pushdecl result. If !is_non_type, also set parm to that. * g++.dg/template/pr90138.C: New test. From-SVN: r270456 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index b35d8758730..db9a3a8d4be 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2019-04-19 Jakub Jelinek + PR c++/90138 + * pt.c (process_template_parm): Set decl to pushdecl result. If + !is_non_type, also set parm to that. + PR c/89888 * decl.c (struct cp_switch): Remove outside_range_p member. (push_switch): Don't clear it. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 3a11eaa7630..842dacf9543 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -4433,7 +4433,9 @@ process_template_parm (tree list, location_t parm_loc, tree parm, process_template_parm could fail. */ tree reqs = finish_shorthand_constraint (parm, constr); - pushdecl (decl); + decl = pushdecl (decl); + if (!is_non_type) + parm = decl; /* Build the parameter node linking the parameter declaration, its default argument (if any), and its constraints (if any). */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a5e5af59f54..0b5c3439bc9 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2019-04-19 Jakub Jelinek + PR c++/90138 + * g++.dg/template/pr90138.C: New test. + PR c/89888 * c-c++-common/pr89888.c: New test. * g++.dg/torture/pr40335.C: Change dg-bogus into dg-warning. diff --git a/gcc/testsuite/g++.dg/template/pr90138.C b/gcc/testsuite/g++.dg/template/pr90138.C new file mode 100644 index 00000000000..473b73db103 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/pr90138.C @@ -0,0 +1,5 @@ +// PR c++/90138 + +template <, typename T, typename typename, typename T> // { dg-error "expected" } +struct S; // { dg-error "no default" } +// { dg-error "two or more" "" { target *-*-* } .-2 }