Skip to content

Commit 8c54d3d

Browse files
committed
[Sema] InitAccessors: Don't synthesize default memberwise arg for init accessor initializations
Default arguments for `init accessors` are not fully supported at the moment, so we shouldn't attempt to synthesize them in Sema just to crash during linking.
1 parent 208eaac commit 8c54d3d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/Sema/CodeSynthesis.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,12 @@ static void maybeAddMemberwiseDefaultArg(ParamDecl *arg, VarDecl *var,
144144
if (!var->getParentPattern()->getSingleVar())
145145
return;
146146

147+
// FIXME: Don't attempt to synthesize default arguments for init
148+
// accessor properties because there could be multiple properties
149+
// with default values they are going to initialize.
150+
if (var->getAccessor(AccessorKind::Init))
151+
return;
152+
147153
// Whether we have explicit initialization.
148154
bool isExplicitlyInitialized = false;
149155
if (auto pbd = var->getParentPatternBinding()) {

0 commit comments

Comments
 (0)