================
@@ -8461,8 +8461,10 @@ TreeTransform<Derived>::TransformSwitchStmt(SwitchStmt 
*S) {
 
   // Transform the body of the switch statement.
   StmtResult Body = getDerived().TransformStmt(S->getBody());
+  // Finish the switch even on error to pop it from Sema's switch stack.
   if (Body.isInvalid())
-    return StmtError();
+    return getDerived().RebuildSwitchStmtBody(S->getSwitchLoc(), Switch.get(),
+                                              nullptr);
----------------
ojhunt wrote:

Why is the first case first invalid case safe but the latter is not? Basically 
the solution here should involve cleaning up the switch stack not producing a 
non-error result.

https://github.com/llvm/llvm-project/pull/211162
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to