diff options
Diffstat (limited to 'source/slang/slang-check-decl.cpp')
| -rw-r--r-- | source/slang/slang-check-decl.cpp | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/source/slang/slang-check-decl.cpp b/source/slang/slang-check-decl.cpp index 23c10ddc2..969c87981 100644 --- a/source/slang/slang-check-decl.cpp +++ b/source/slang/slang-check-decl.cpp @@ -2037,10 +2037,11 @@ namespace Slang if (overloadContext.bestCandidates[0].status != OverloadCandidate::Status::Applicable) { getShared()->cacheImplicitCastMethod(key, ImplicitCastMethod{}); - return; } - - getSink()->diagnose(varDecl, Diagnostics::ambiguousDefaultInitializerForType, type); + else + { + getSink()->diagnose(varDecl, Diagnostics::ambiguousDefaultInitializerForType, type); + } } else if(overloadContext.bestCandidate) { @@ -2053,16 +2054,17 @@ namespace Slang if (overloadContext.bestCandidate->status != OverloadCandidate::Status::Applicable) { getShared()->cacheImplicitCastMethod(key, ImplicitCastMethod{}); - return; } - - // If we had a single best candidate *and* it was applicable, - // then we use it to construct a new initial-value expression - // for the variable, that will be used for all downstream - // code generation. - // - varDecl->initExpr = CompleteOverloadCandidate(overloadContext, *overloadContext.bestCandidate); - getShared()->cacheImplicitCastMethod(key, ImplicitCastMethod{ *overloadContext.bestCandidate, 0}); + else + { + // If we had a single best candidate *and* it was applicable, + // then we use it to construct a new initial-value expression + // for the variable, that will be used for all downstream + // code generation. + // + varDecl->initExpr = CompleteOverloadCandidate(overloadContext, *overloadContext.bestCandidate); + getShared()->cacheImplicitCastMethod(key, ImplicitCastMethod{*overloadContext.bestCandidate, 0}); + } } } |
