diff options
Diffstat (limited to 'source')
| -rw-r--r-- | source/slang/slang-check-overload.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/source/slang/slang-check-overload.cpp b/source/slang/slang-check-overload.cpp index 6180ccda8..703771e6e 100644 --- a/source/slang/slang-check-overload.cpp +++ b/source/slang/slang-check-overload.cpp @@ -2093,7 +2093,21 @@ namespace Slang typeCheckingCache->resolvedOperatorOverloadCache[key] = *context.bestCandidate; return CompleteOverloadCandidate(context, *context.bestCandidate); } - else if (auto typetype = as<TypeType>(funcExprType)) + + // If absolutely no viable candidates were extracted from the overloaded expression, + // we may be dealing with a composite type or an overloaded expression with composite types. + // + + auto typeExpr = funcExpr; + if (auto overloadedExpr = as<OverloadedExpr>(funcExpr)) + { + if (overloadedExpr->lookupResult2.isValid() && overloadedExpr->lookupResult2.isOverloaded()) + { + typeExpr = maybeResolveOverloadedExpr(overloadedExpr, LookupMask::type, nullptr); + } + } + + if (auto typetype = as<TypeType>(typeExpr->type)) { // We allow a special case when `funcExpr` represents a composite type, // in which case we will try to construct the type via memberwise assignment from the arguments. |
