[clang] [Clang] Fix double revert of a keyword token that was cached before the first fallback (PR #219799)

Shengxin Pei via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 31 01:19:12 PDT 2026


================
@@ -0,0 +1,20 @@
+// RUN: %clang_cc1 -fsyntax-only -verify=expected,garbage -DGARBAGE %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+// The undeclared template-name 'foo' starts a tentative parse that caches the
+// rest of the file, so the second '__make_unsigned' token keeps its keyword
+// kind after the first one has already been reverted to an identifier.
+#ifdef GARBAGE
+foo < bar()
+// garbage-error at -1 {{no template named 'foo'}}
+// garbage-error at -2 {{use of undeclared identifier 'bar'}}
+// garbage-error at -3 {{expected '>'}}
+// garbage-note at -4 {{to match this '<'}}
+#endif
+
+namespace N { // garbage-error {{expected unqualified-id}}
----------------
TPPPP72 wrote:

Remove the namespace

https://github.com/llvm/llvm-project/pull/219799


More information about the cfe-commits mailing list