re PR c++/77637 (ICE on x86_64-linux-gnu (Segmentation fault, tree_check, cp_parser_s...
authorJakub Jelinek <jakub@redhat.com>
Tue, 20 Sep 2016 15:16:55 +0000 (17:16 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 20 Sep 2016 15:16:55 +0000 (17:16 +0200)
PR c++/77637
* parser.c (cp_parser_std_attribute_list): Reject ... without
preceding attribute.

* g++.dg/cpp0x/gen-attrs-62.C: New test.

From-SVN: r240265

gcc/cp/ChangeLog
gcc/cp/parser.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/gen-attrs-62.C [new file with mode: 0644]

index 6aa79a9409f3d21255bb5d49b55bc214cc563170..35ad431723d40ec4450f90341e7aaf428e12300e 100644 (file)
@@ -1,3 +1,9 @@
+2016-09-20  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/77637
+       * parser.c (cp_parser_std_attribute_list): Reject ... without
+       preceding attribute.
+
 2016-09-19  Bernd Edlinger  <bernd.edlinger@hotmail.de>
 
        PR c++/77434
index c03b9c2e5e3d4ea91f98280fb98db0cd82b256c3..9a20a5f0945ecc3fd02ff218619da563947e7ffe 100644 (file)
@@ -24221,8 +24221,12 @@ cp_parser_std_attribute_list (cp_parser *parser, tree attr_ns)
       if (token->type == CPP_ELLIPSIS)
        {
          cp_lexer_consume_token (parser->lexer);
-         TREE_VALUE (attribute)
-           = make_pack_expansion (TREE_VALUE (attribute));
+         if (attribute == NULL_TREE)
+           error_at (token->location,
+                     "expected attribute before %<...%>");
+         else
+           TREE_VALUE (attribute)
+             = make_pack_expansion (TREE_VALUE (attribute));
          token = cp_lexer_peek_token (parser->lexer);
        }
       if (token->type != CPP_COMMA)
index d434027b52b18ba04cf0842e6cd4147053b27d27..b4524f062e32833780f9831eae4ea28215e96ab1 100644 (file)
@@ -1,5 +1,8 @@
 2016-09-20  Jakub Jelinek  <jakub@redhat.com>
 
+       PR c++/77637
+       * g++.dg/cpp0x/gen-attrs-62.C: New test.
+
        PR middle-end/77624
        * c-c++-common/pr77624-1.c: New test.
        * c-c++-common/pr77624-2.c: New test.
diff --git a/gcc/testsuite/g++.dg/cpp0x/gen-attrs-62.C b/gcc/testsuite/g++.dg/cpp0x/gen-attrs-62.C
new file mode 100644 (file)
index 0000000..5bd8778
--- /dev/null
@@ -0,0 +1,5 @@
+// PR c++/77637
+// { dg-do compile { target c++11 } }
+
+int [[...]] a;         // { dg-error "expected attribute before '...'" }
+int [[,,...]] b;       // { dg-error "expected attribute before '...'" }