Hi!

As mentioned in the PR, cp_parser_parse_definitely may fail even when
alignas_expr actually is meaningful, e.g. when the error is due to the
missing closing paren.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2017-01-10  Jakub Jelinek  <ja...@redhat.com>

        PR c++/78341
        * parser.c (cp_parser_std_attribute_spec): Remove over-eager
        assertion.  Formatting fix.

        * g++.dg/cpp0x/pr78341.C: New test.

--- gcc/cp/parser.c.jj  2017-01-10 08:12:46.000000000 +0100
+++ gcc/cp/parser.c     2017-01-10 11:09:04.217456830 +0100
@@ -24931,11 +24931,7 @@ cp_parser_std_attribute_spec (cp_parser
 
       if (!cp_parser_parse_definitely (parser))
        {
-         gcc_assert (alignas_expr == error_mark_node
-                     || alignas_expr == NULL_TREE);
-
-         alignas_expr =
-           cp_parser_assignment_expression (parser);
+         alignas_expr = cp_parser_assignment_expression (parser);
          if (alignas_expr == error_mark_node)
            cp_parser_skip_to_end_of_statement (parser);
          if (alignas_expr == NULL_TREE
--- gcc/testsuite/g++.dg/cpp0x/pr78341.C.jj     2017-01-10 11:11:10.368843803 
+0100
+++ gcc/testsuite/g++.dg/cpp0x/pr78341.C        2017-01-10 11:10:52.000000000 
+0100
@@ -0,0 +1,4 @@
+// PR c++/78341
+// { dg-do compile { target c++11 } }
+
+alignas (alignas double // { dg-error "" }

        Jakub

Reply via email to