diff --git a/regression/cpp/gcc_attributes2/main.cpp b/regression/cpp/gcc_attributes2/main.cpp index d6deee476fd..c10788c077f 100644 --- a/regression/cpp/gcc_attributes2/main.cpp +++ b/regression/cpp/gcc_attributes2/main.cpp @@ -1,6 +1,11 @@ #ifdef __GNUC__ typedef int my_int16_t __attribute__((__mode__(__HI__))); static_assert(sizeof(my_int16_t) == 2, "16 bit"); + +template +struct __attribute__((__aligned__((_Align)))) +{ +} __align; #endif int main() diff --git a/src/cpp/parse.cpp b/src/cpp/parse.cpp index 910d91a5811..0948d6bf07f 100644 --- a/src/cpp/parse.cpp +++ b/src/cpp/parse.cpp @@ -4486,6 +4486,12 @@ bool Parser::rClassSpec(typet &spec) std::cout << std::string(__indent, ' ') << "Parser::rClassSpec 3\n"; #endif + if(!optAlignas(spec)) + return false; + + if(!optAttribute(spec)) + return false; + if(lex.LookAhead(0)=='{') { // no tag @@ -4495,12 +4501,6 @@ bool Parser::rClassSpec(typet &spec) } else { - if(!optAlignas(spec)) - return false; - - if(!optAttribute(spec)) - return false; - irept name; if(!rName(name))