Skip to content

Commit a98ea99

Browse files
authored
Merge pull request #81467 from DougGregor/objc-enum-unsafe-bit-cast-warning-6.2
[6.2] [Strict memory safety] Squash warning about unsafety in "@objc enum" synthesized code
2 parents 02c160c + 7b6fe8f commit a98ea99

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/Sema/DerivedConformance/DerivedConformanceRawRepresentable.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,9 @@ deriveBodyRawRepresentable_raw(AbstractFunctionDecl *toRawDecl, void *) {
105105

106106
auto *argList = ArgumentList::forImplicitCallTo(functionRef->getName(),
107107
{selfRef, typeExpr}, C);
108-
auto call = CallExpr::createImplicit(C, functionRef, argList);
108+
Expr *call = CallExpr::createImplicit(C, functionRef, argList);
109+
if (C.LangOpts.hasFeature(Feature::StrictMemorySafety))
110+
call = UnsafeExpr::createImplicit(C, SourceLoc(), call);
109111
auto *returnStmt = ReturnStmt::createImplicit(C, call);
110112
auto body = BraceStmt::create(C, SourceLoc(), ASTNode(returnStmt),
111113
SourceLoc());

0 commit comments

Comments
 (0)