forked from OSchip/llvm-project
Make sure we call MaybeCreateExprWithCleanups for the sub-expression of an indirect goto.
llvm-svn: 149441
This commit is contained in:
parent
87d3280985
commit
9ccdb1d01b
|
@ -1611,6 +1611,7 @@ Sema::ActOnIndirectGotoStmt(SourceLocation GotoLoc, SourceLocation StarLoc,
|
|||
E = ExprRes.take();
|
||||
if (DiagnoseAssignmentResult(ConvTy, StarLoc, DestTy, ETy, E, AA_Passing))
|
||||
return StmtError();
|
||||
E = MaybeCreateExprWithCleanups(E);
|
||||
}
|
||||
|
||||
getCurFunction()->setHasIndirectGoto();
|
||||
|
|
|
@ -5326,6 +5326,7 @@ TreeTransform<Derived>::TransformIndirectGotoStmt(IndirectGotoStmt *S) {
|
|||
ExprResult Target = getDerived().TransformExpr(S->getTarget());
|
||||
if (Target.isInvalid())
|
||||
return StmtError();
|
||||
Target = SemaRef.MaybeCreateExprWithCleanups(Target.take());
|
||||
|
||||
if (!getDerived().AlwaysRebuild() &&
|
||||
Target.get() == S->getTarget())
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
// RUN: %clang_cc1 -fsyntax-only -verify %s
|
||||
|
||||
namespace test1 {
|
||||
// Make sure this doesn't crash.
|
||||
struct A { ~A(); };
|
||||
void a() { goto *(A(), &&L); L: return; }
|
||||
}
|
Loading…
Reference in New Issue