Skip to content

Commit 8fb4b1c

Browse files
authored
Merge pull request swiftlang#81466 from DougGregor/objc-enum-unsafe-bit-cast-warning
[Strict memory safety] Squash warning about unsafety in "@objc enum" synthesized code
2 parents b5a31e3 + fcd206f commit 8fb4b1c

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)