[clang] [C23] Fix typeof handling in enum declarations (PR #146394)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 2 11:43:30 PDT 2025


================
@@ -2850,7 +2870,8 @@ Parser::ParseParenExpression(ParenParseOption &ExprType, bool stopIfCastExpr,
              isFoldOperator(NextToken().getKind())) {
     ExprType = ParenParseOption::FoldExpr;
     return ParseFoldExpression(ExprResult(), T);
-  } else if (isTypeCast) {
+  } else if (CorrectionBehavior == TypoCorrectionTypeBehavior::AllowTypes) {
+    // FIXME: This should not be predicated on typo correction behavior.
----------------
AaronBallman wrote:

This is worth noting!

This was an unfortunate surprise. However, it's a preexisting defect that I don't have the bandwidth to correct right now.

The old `TypeCastState` enumeration was introduced to help with typo correction (https://github.com/llvm/llvm-project/commit/77e21fca3cd1a9db882ac13ac5ddef3f278dfff2) and we accidentally ended up using it for parsing decisions: https://github.com/llvm/llvm-project/blob/a63f57262898588b576d66e5fd79c0aa64b35f2d/clang/lib/Parse/ParseExpr.cpp#L761

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


More information about the cfe-commits mailing list