re PR c++/90138 (ICE on invalid in contains_struct_check())
authorJakub Jelinek <jakub@redhat.com>
Fri, 19 Apr 2019 11:57:23 +0000 (13:57 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 19 Apr 2019 11:57:23 +0000 (13:57 +0200)
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

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/template/pr90138.C [new file with mode: 0644]

index b35d875873056e4b1cbf290c7e5b6f4084daa3fb..db9a3a8d4be48a0f2c285989ae9162cd6a1abba9 100644 (file)
@@ -1,5 +1,9 @@
 2019-04-19  Jakub Jelinek  <jakub@redhat.com>
 
+       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.
index 3a11eaa763009d754af71bfb65c659376faf0650..842dacf95431c638a149afcd2f0d2ecf0989cb5d 100644 (file)
@@ -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). */
index a5e5af59f548d4f45b377990389fed02e1b87ac8..0b5c3439bc93079098a8bc09617b1d121237c8c7 100644 (file)
@@ -1,5 +1,8 @@
 2019-04-19  Jakub Jelinek  <jakub@redhat.com>
 
+       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 (file)
index 0000000..473b73d
--- /dev/null
@@ -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 }