================
@@ -4093,7 +4093,30 @@ void Parser::ParseDeclarationSpecifiers(
       break;
     case tok::kw_auto:
       if (getLangOpts().CPlusPlus11 || getLangOpts().C23) {
-        if (isKnownToBeTypeSpecifier(GetLookAheadToken(1))) {
+        auto IsTypeSpecifier = [&]() {
+          if (DS.hasTypeSpecifier() &&
+              DS.getTypeSpecType() != DeclSpec::TST_auto)
+            return true;
+
+          unsigned I = 1;
+          while (true) {
+            const Token &T = GetLookAheadToken(I);
+            if (isKnownToBeTypeSpecifier(T))
+              return true;
+
+            if (T.isOneOf(tok::kw_typeof, tok::kw_typeof_unqual,
+                          tok::kw__Atomic) &&
+                GetLookAheadToken(I + 1).is(tok::l_paren))
+              return true;
----------------
AaronBallman wrote:

What happens with code like:
```
void func() {
  signed int _Atomic auto i = 12; // Accept due to valid but useless storage 
class specifier
}
signed int _Atomic auto j = 12; // Reject due to invalid storage class specifier
```


https://github.com/llvm/llvm-project/pull/177865
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to