re PR c++/77638 (ICE on x86_64-linux-gnu (internal compiler error: tree check: expect...
authorJakub Jelinek <jakub@redhat.com>
Tue, 20 Sep 2016 15:17:41 +0000 (17:17 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 20 Sep 2016 15:17:41 +0000 (17:17 +0200)
PR c++/77638
* parser.c (cp_parser_template_declaration_after_parameter): For 2
argument operator"" template set ok to false for
parm == error_mark_node.

* g++.dg/cpp0x/udlit-tmpl-arg-neg2.C: New test.

From-SVN: r240266

gcc/cp/ChangeLog
gcc/cp/parser.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/udlit-tmpl-arg-neg2.C [new file with mode: 0644]

index 35ad431723d40ec4450f90341e7aaf428e12300e..5efc79522befdee9701538f57ac5b4ac007f4458 100644 (file)
@@ -1,5 +1,10 @@
 2016-09-20  Jakub Jelinek  <jakub@redhat.com>
 
+       PR c++/77638
+       * parser.c (cp_parser_template_declaration_after_parameter): For 2
+       argument operator"" template set ok to false for
+       parm == error_mark_node.
+
        PR c++/77637
        * parser.c (cp_parser_std_attribute_list): Reject ... without
        preceding attribute.
index 9a20a5f0945ecc3fd02ff218619da563947e7ffe..168486c741c7a37869eb336b9b7fded40eec3028 100644 (file)
@@ -25723,7 +25723,8 @@ cp_parser_template_declaration_after_parameters (cp_parser* parser,
              tree type = INNERMOST_TEMPLATE_PARMS (parm_type);
              tree parm_list = TREE_VEC_ELT (parameter_list, 1);
              tree parm = INNERMOST_TEMPLATE_PARMS (parm_list);
-             if (TREE_TYPE (parm) != TREE_TYPE (type)
+             if (parm == error_mark_node
+                 || TREE_TYPE (parm) != TREE_TYPE (type)
                  || !TEMPLATE_PARM_PARAMETER_PACK (DECL_INITIAL (parm)))
                ok = false;
            }
index b4524f062e32833780f9831eae4ea28215e96ab1..8ffa014add7daf84e639416491a924e41929b918 100644 (file)
@@ -1,5 +1,8 @@
 2016-09-20  Jakub Jelinek  <jakub@redhat.com>
 
+       PR c++/77638
+       * g++.dg/cpp0x/udlit-tmpl-arg-neg2.C: New test.
+
        PR c++/77637
        * g++.dg/cpp0x/gen-attrs-62.C: New test.
 
diff --git a/gcc/testsuite/g++.dg/cpp0x/udlit-tmpl-arg-neg2.C b/gcc/testsuite/g++.dg/cpp0x/udlit-tmpl-arg-neg2.C
new file mode 100644 (file)
index 0000000..c426e0e
--- /dev/null
@@ -0,0 +1,7 @@
+// PR c++/77638
+// { dg-do compile { target c++11 } }
+
+template <T, T... U>           // { dg-error "'T' has not been declared" }
+int operator"" _foo ();                // { dg-error "has invalid parameter list" }
+template <T... U>              // { dg-error "'T' has not been declared" }
+int operator"" _bar ();                // { dg-error "has invalid parameter list" }