@@ -230,6 +230,24 @@ void Parser::keepTrackDebug()
230230#endif
231231}
232232
233+ bool Parser::skipAlignas ()
234+ {
235+ // we are currently not interested in alignas, so we just skip it
236+ if (token_stream.lookAhead () == Token_alignas)
237+ {
238+ nextToken ();
239+ if (token_stream.lookAhead () == ' (' )
240+ {
241+ if (skip (' (' , ' )' ))
242+ {
243+ nextToken ();
244+ }
245+ }
246+ return true ;
247+ }
248+ return false ;
249+ }
250+
233251bool Parser::skipAttributes ()
234252{
235253 bool any = false ;
@@ -422,7 +440,10 @@ bool Parser::parseName(NameAST *&node, bool acceptTemplateId)
422440 std::size_t start = token_stream.cursor ();
423441
424442 WinDeclSpecAST *winDeclSpec = 0 ;
425- parseWinDeclSpec (winDeclSpec);
443+ while (skipAlignas () || (!winDeclSpec && parseWinDeclSpec (winDeclSpec)))
444+ {
445+ ;
446+ }
426447
427448 NameAST *ast = CreateNode<NameAST>(_M_pool);
428449
@@ -2054,9 +2075,10 @@ bool Parser::parseClassSpecifier(TypeSpecifierAST *&node)
20542075 nextToken ();
20552076
20562077 WinDeclSpecAST *winDeclSpec = 0 ;
2057- parseWinDeclSpec (winDeclSpec);
2058-
2059- skipAttributes ();
2078+ while (skipAttributes () || skipAlignas () || (!winDeclSpec && parseWinDeclSpec (winDeclSpec)))
2079+ {
2080+ ;
2081+ }
20602082
20612083 while (token_stream.lookAhead () == Token_identifier
20622084 && token_stream.lookAhead (1 ) == Token_identifier)
@@ -3359,7 +3381,8 @@ bool Parser::parseDeclarationInternal(DeclarationAST *&node)
33593381 // so just consume then until no specifiers are left.
33603382 // Luckily the parse methods can be called multiple times, they just add to existing nodes.
33613383 while (skipAttributes () ||
3362- parseWinDeclSpec (winDeclSpec) ||
3384+ skipAlignas () ||
3385+ (!winDeclSpec && parseWinDeclSpec (winDeclSpec)) ||
33633386 parseCvQualify (cv) ||
33643387 parseFunctionSpecifier (funSpec) ||
33653388 parseStorageClassSpecifier (storageSpec))
0 commit comments