diff --git a/gcc/cp/parser.cc b/gcc/cp/parser.cc index ffb22aa776f..51d26cecc4b 100644 --- a/gcc/cp/parser.cc +++ b/gcc/cp/parser.cc @@ -31830,7 +31830,7 @@ cp_parser_base_specifier (cp_parser* parser) tree std_attrs = cp_parser_std_attribute_spec_seq (parser); tree annotations = NULL_TREE; - if (std_attrs != NULL_TREE) + if (std_attrs != NULL_TREE && std_attrs != error_mark_node) { tree *pannotations = &annotations; for (tree attr = std_attrs; attr; attr = TREE_CHAIN (attr)) diff --git a/gcc/testsuite/g++.dg/cpp0x/alignas24.C b/gcc/testsuite/g++.dg/cpp0x/alignas24.C new file mode 100644 index 00000000000..2966a9c2aa3 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/alignas24.C @@ -0,0 +1,5 @@ +// PR c++/124307 +// { dg-do compile { target c++11 } } +// { dg-options "" } + +class : alignas // { dg-error "" }