We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 77a411a commit 0455913Copy full SHA for 0455913
lib/AST/Decl.cpp
@@ -6856,7 +6856,13 @@ Type ConstructorDecl::getInitializerInterfaceType() {
6856
return InitializerInterfaceType;
6857
6858
// Lazily calculate initializer type.
6859
- auto funcTy = getInterfaceType()->castTo<AnyFunctionType>()->getResult();
+ auto allocatorTy = getInterfaceType();
6860
+ if (!allocatorTy->is<AnyFunctionType>()) {
6861
+ InitializerInterfaceType = ErrorType::get(getASTContext());
6862
+ return InitializerInterfaceType;
6863
+ }
6864
+
6865
+ auto funcTy = allocatorTy->castTo<AnyFunctionType>()->getResult();
6866
assert(funcTy->is<FunctionType>());
6867
6868
// Constructors have an initializer type that takes an instance
0 commit comments