]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR c++/77637 (ICE on x86_64-linux-gnu (Segmentation fault, tree_check...
authorJakub Jelinek <jakub@redhat.com>
Tue, 30 May 2017 07:27:33 +0000 (09:27 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 30 May 2017 07:27:33 +0000 (09:27 +0200)
Backported from mainline
2016-09-20  Jakub Jelinek  <jakub@redhat.com>

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: r248611

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 487e2c7bb97b516d31eef683f43ca6650a1ad0f3..7770101444ea78bb39af3701aa3c08756ec84bf5 100644 (file)
@@ -1,6 +1,12 @@
 2017-05-30  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2016-09-20  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/77637
+       * parser.c (cp_parser_std_attribute_list): Reject ... without
+       preceding attribute.
+
        2016-09-16  Jakub Jelinek  <jakub@redhat.com>
 
        PR c++/77375
index 03b93ab2d751fba418e93346ec3fe16505f58d29..2cfcd79d05056e128543516a6f2090517ee6fc2f 100644 (file)
@@ -22528,8 +22528,12 @@ cp_parser_std_attribute_list (cp_parser *parser)
       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 7a2b4bc8c68227c30d8312ff433daca6b1cad427..0192f663886a462d85e21b643dab0c9fe62f23b2 100644 (file)
@@ -3,6 +3,9 @@
        Backported from mainline
        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 '...'" }