+2018-01-17 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/78344
+ * decl.c (grokdeclarator): Do not append the error_mark_node
+ due to an erroneous optional attribute-specifier-seq.
+
2018-01-17 Jakub Jelinek <jakub@redhat.com>
PR c++/83897
&& declarator->kind == cdk_id
&& declarator->std_attributes
&& attrlist != NULL)
- /* [dcl.meaning]/1: The optional attribute-specifier-seq following
- a declarator-id appertains to the entity that is declared. */
- *attrlist = chainon (*attrlist, declarator->std_attributes);
+ {
+ /* [dcl.meaning]/1: The optional attribute-specifier-seq following
+ a declarator-id appertains to the entity that is declared. */
+ if (declarator->std_attributes != error_mark_node)
+ *attrlist = chainon (*attrlist, declarator->std_attributes);
+ else
+ /* We should have already diagnosed the issue (c++/78344). */
+ gcc_assert (seen_error ());
+ }
/* Handle parameter packs. */
if (parameter_pack_p)
--- /dev/null
+// PR c++/78344
+// { dg-do compile { target c++11 } }
+
+alignas(double) int f alignas; // { dg-error "30:expected '\\('" }
+alignas(double) int g alignas(double; // { dg-error "37:expected '\\)'" }