Skip to content

Commit 296aa35

Browse files
Tentative fix
1 parent d398fa1 commit 296aa35

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

clang/lib/Sema/SemaExpr.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15861,10 +15861,19 @@ ExprResult Sema::ActOnStmtExprResult(ExprResult ER) {
1586115861
if (Cast && Cast->getCastKind() == CK_ARCConsumeObject)
1586215862
return Cast->getSubExpr();
1586315863

15864+
auto Ty = E->getType().getUnqualifiedType();
15865+
15866+
// If the type is an atomic, the statement type is the underlying type.
15867+
if (const AtomicType *AT = Ty->getAs<AtomicType>()) {
15868+
Ty = AT->getValueType().getUnqualifiedType();
15869+
return ImplicitCastExpr::Create(Context, Ty, CK_AtomicToNonAtomic, E,
15870+
/*base path*/ nullptr, VK_PRValue,
15871+
FPOptionsOverride());
15872+
}
15873+
1586415874
// FIXME: Provide a better location for the initialization.
1586515875
return PerformCopyInitialization(
15866-
InitializedEntity::InitializeStmtExprResult(
15867-
E->getBeginLoc(), E->getType().getUnqualifiedType()),
15876+
InitializedEntity::InitializeStmtExprResult(E->getBeginLoc(), Ty),
1586815877
SourceLocation(), E);
1586915878
}
1587015879

0 commit comments

Comments
 (0)