================
@@ -1136,6 +1136,20 @@ void Parser::AnnotateExistingDecltypeSpecifier(const
DeclSpec &DS,
// make sure we have a token we can turn into an annotation token
if (PP.isBacktrackEnabled()) {
PP.RevertCachedTokens(1);
+ if (DS.getTypeSpecType() == TST_error && PP.hasCachedTokenLocation()) {
----------------
akashagrwl wrote:
Reworked it — the fix now drops the invalid decltype-specifier right in
ParseOptionalCXXScopeSpecifier, with an early return false on TST_error
immediately after ParseDecltypeSpecifier, before any annotation happens. The
hasCachedTokenLocation() helper and the AnnotateExistingDecltypeSpecifier
special-casing are both removed — there's no longer a code path that annotates
an errored DeclSpec, so the stale-EndLoc problem this was patching around can't
occur. This mirrors the adjacent pack-indexing branch, which already bails out
the same way on TST_error. Also added a release note.
https://github.com/llvm/llvm-project/pull/211221
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits