Index: clang/lib/CodeGen/CGException.cpp =================================================================== --- clang/lib/CodeGen/CGException.cpp +++ clang/lib/CodeGen/CGException.cpp @@ -1966,7 +1966,6 @@ StartFunction(GlobalDecl(), RetTy, Fn, FnInfo, Args, OutlinedStmt->getBeginLoc(), OutlinedStmt->getBeginLoc()); CurSEHParent = ParentCGF.CurSEHParent; - CurCodeDecl = ParentCGF.CurCodeDecl; CGM.SetInternalFunctionAttributes(GlobalDecl(), CurFn, FnInfo); EmitCapturedLocals(ParentCGF, OutlinedStmt, IsFilter); Index: clang/lib/CodeGen/CGExpr.cpp =================================================================== --- clang/lib/CodeGen/CGExpr.cpp +++ clang/lib/CodeGen/CGExpr.cpp @@ -4185,8 +4185,8 @@ /// Given that we are currently emitting a lambda, emit an l-value for /// one of its members. LValue CodeGenFunction::EmitLValueForLambdaField(const FieldDecl *Field) { - assert(cast(CurCodeDecl)->getParent()->isLambda()); - assert(cast(CurCodeDecl)->getParent() == Field->getParent()); + assert(IsOutlinedSEHHelper || cast(CurCodeDecl)->getParent()->isLambda()); + assert(IsOutlinedSEHHelper || cast(CurCodeDecl)->getParent() == Field->getParent()); QualType LambdaTagType = getContext().getTagDeclType(Field->getParent()); LValue LambdaLV = MakeNaturalAlignAddrLValue(CXXABIThisValue, LambdaTagType); Index: clang/test/CodeGenCXX/exceptions-seh.cpp =================================================================== --- clang/test/CodeGenCXX/exceptions-seh.cpp +++ clang/test/CodeGenCXX/exceptions-seh.cpp @@ -164,3 +164,5 @@ // CHECK: store i32 1234, i32* @my_unique_global // CHECK: attributes #[[NOINLINE]] = { {{.*noinline.*}} } + +void seh_in_noexcept() noexcept { __try {} __finally {} }