diff --git a/lib/Sema/TypeCheckDecl.cpp b/lib/Sema/TypeCheckDecl.cpp index 80fc5d40b0246..00587e572c904 100644 --- a/lib/Sema/TypeCheckDecl.cpp +++ b/lib/Sema/TypeCheckDecl.cpp @@ -5011,6 +5011,10 @@ class DeclChecker : public DeclVisitor { return false; if (func->isGeneric() != parentFunc->isGeneric()) return false; + } else if (auto ctor = dyn_cast(decl)) { + auto parentCtor = cast(parentDecl); + if (ctor->isGeneric() != parentCtor->isGeneric()) + return false; } else if (auto var = dyn_cast(decl)) { auto parentVar = cast(parentDecl); if (var->isStatic() != parentVar->isStatic()) diff --git a/validation-test/compiler_crashers_2_fixed/0078-sr4059.swift b/validation-test/compiler_crashers_2_fixed/0078-sr4059.swift new file mode 100644 index 0000000000000..a073b137d52d5 --- /dev/null +++ b/validation-test/compiler_crashers_2_fixed/0078-sr4059.swift @@ -0,0 +1,9 @@ +// RUN: %target-swift-frontend %s -emit-ir + +class Base { + init(_ s: S) where S.Iterator.Element == UInt8 { } +} + +class Sub: Base { + init(_ b: [UInt8]) { super.init(b) } +} \ No newline at end of file