================
@@ -0,0 +1,22 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++14 %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++17 %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++20 %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++23 %s
+
+// Test that 'auto' cannot be combined with a type specifier in C++.
+void f() {
+ auto int x = 1; // expected-error {{'auto' cannot be combined with a
type specifier}}
----------------
AaronBallman wrote:
I think:
```
if (isKnownToBeTypeSpecifier(GetLookAheadToken(1)))
```
will need to be factored away, then. When I looked into this, the issue is that
the token we get is not actually annotated because nothing calls a
`TryAnnotate*()` function to turn it into an annotation token. IIRC, those
functions all work off `Tok`, not a given `Token`, and they work by modifying
the token stream itself (so may not work well as a lookahead function).
https://github.com/llvm/llvm-project/pull/166004
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits