After we parse the switch condition, we don't do the type check for
type-dependent expr (e.g. TypoExpr) (in Sema::CheckSwitchCondition), then the
TypoExpr is corrected to an invalid-type expr (in Sema::MakeFullExpr) and passed
to the ActOnStartOfSwitchStmt, which triggers the assertion.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
clang/lib/Sema/SemaStmt.cpp | ||
---|---|---|
709 | How do we know Cond is a TypoExpr directly rather than containing one? I think the usual strategy when code can't deal with typo correction being delayed further is to call CorrectDelayedTyposInExpr. |
clang/lib/Sema/SemaStmt.cpp | ||
---|---|---|
709 | no sure whether we should consider the containing-typo Cond, we might still want to keep the typo correction? thinking a case like switch(return_int(typo-expr)) {}. Do you suggest that we use the CorrectDelayedTyposInExpr to check the whether Cond is/has a TypoExpr? CorrectDelayedTyposInExpr has a side effect of emitting the typo-suggestion diagnostic. |
How do we know Cond is a TypoExpr directly rather than containing one?
I think the usual strategy when code can't deal with typo correction being delayed further is to call CorrectDelayedTyposInExpr.