@@ -8540,16 +8540,20 @@ void TypeChecker::addImplicitConstructors(NominalTypeDecl *decl) {
8540
8540
8541
8541
// Bail out if we're validating one of our constructors already; we'll
8542
8542
// revisit the issue later.
8543
- bool alreadyValidatingCtor = false ;
8544
- for (auto member : decl->getMembers ()) {
8545
- if (auto ctor = dyn_cast<ConstructorDecl>(member)) {
8546
- validateDecl (ctor);
8547
- if (!ctor->hasValidSignature ())
8548
- alreadyValidatingCtor = true ;
8543
+ if (isa<ClassDecl>(decl)) {
8544
+ bool alreadyValidatingCtor = false ;
8545
+ for (auto member : decl->getMembers ()) {
8546
+ if (auto ctor = dyn_cast<ConstructorDecl>(member)) {
8547
+ validateDecl (ctor);
8548
+ if (!ctor->hasValidSignature ())
8549
+ alreadyValidatingCtor = true ;
8550
+ }
8549
8551
}
8552
+ if (alreadyValidatingCtor)
8553
+ return ;
8550
8554
}
8551
- if (alreadyValidatingCtor)
8552
- return ;
8555
+
8556
+ decl-> setAddedImplicitInitializers () ;
8553
8557
8554
8558
// Check whether there is a user-declared constructor or an instance
8555
8559
// variable.
@@ -8558,7 +8562,6 @@ void TypeChecker::addImplicitConstructors(NominalTypeDecl *decl) {
8558
8562
bool SuppressMemberwiseInitializer = false ;
8559
8563
bool FoundSynthesizedInit = false ;
8560
8564
bool FoundDesignatedInit = false ;
8561
- decl->setAddedImplicitInitializers ();
8562
8565
8563
8566
// Before we look for constructors, we need to make sure that all synthesized
8564
8567
// initializers are properly synthesized.
@@ -8600,6 +8603,9 @@ void TypeChecker::addImplicitConstructors(NominalTypeDecl *decl) {
8600
8603
FoundDesignatedInit = true ;
8601
8604
}
8602
8605
8606
+ if (isa<StructDecl>(decl))
8607
+ continue ;
8608
+
8603
8609
if (!ctor->isInvalid ())
8604
8610
initializerParamTypes.insert (getInitializerParamType (ctor));
8605
8611
0 commit comments