Haojian Wu 6aa2e49648
[clang][Parser] Fix an assertion during decltype error recovery with missing ; (#188123)
Fix an assertion failure in `ParseDecltypeSpecifier` when parsing
malformed expressions e.g. `decltype(union { ... )`.

When a class/union definition is missing a semicolon, clang's error
recovery may synthetically set the current token to `tok::semi` without
actually inserting it into the preprocessor's backtrack cache, see
9096c9cda3/clang/lib/Parse/ParseDeclCXX.cpp (L1920-L1927)

If `ParseDecltypeSpecifier` later encounters this synthetic semicolon
during its own error recovery, its attempts to revert the cache and
re-lex the tokens will lead to reading unexpected tokens from the
historical stream, failing the strict
`Tok.is(tok::semi)` assertion.

This patch removes this assertion, acknowledging that during invalid
parses and error recovery, the preprocessor's cache state may not
strictly align with the parser's simulated state.


Fixes: #188014
2026-03-31 20:30:28 +00:00
..
2024-05-21 15:01:13 -04:00
2023-08-28 12:13:42 -04:00
2017-04-04 21:18:36 +00:00
2023-08-28 12:13:42 -04:00
2023-08-28 12:13:42 -04:00
2023-08-28 12:13:42 -04:00
2023-08-28 12:13:42 -04:00
2023-08-28 12:13:42 -04:00
2023-08-28 12:13:42 -04:00
2023-08-28 12:13:42 -04:00
2023-08-28 12:13:42 -04:00
2011-12-22 23:26:17 +00:00