================ @@ -1970,6 +2024,13 @@ Sema::ConditionResult Parser::ParseCXXCondition(StmtResult *InitStmt, DeclSpec DS(AttrFactory); ParseSpecifierQualifierList(DS, AS_none, DeclSpecContext::DSC_condition); + // The Declarator's DeclarationAttrs only accepts [[]] and keyword attributes; + // move any GNU attributes onto the DeclSpec instead. + if (!getLangOpts().CPlusPlus) ---------------- cor3ntin wrote:
I still don't see that as a reason to have a different parse in C vs C++. This is valid c++ https://godbolt.org/z/WM4P6vYTc (per https://eel.is/c++draft/stmt.pre#nt:init-statement) And we can (and do, afaict) support gnu attributes in there (ie that's outside of the scope of the standards) `if([[]] int x; true)` is the only thing we should not support in C++ (and I'm not convinced that's not an omission in the wording frankly) https://github.com/llvm/llvm-project/pull/198244 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
