From 8a15efb37a33d3c2943be87a19cbf9b5e2e8432b Mon Sep 17 00:00:00 2001 From: ArielG-NV <159081215+ArielG-NV@users.noreply.github.com> Date: Fri, 1 Aug 2025 12:36:29 -0700 Subject: Drain sink when single-argument constructor call fail (#7883) * fix bug * fix test * push test changs for clarity * fix bug * fix test * push test changs for clarity * test what fails * remove redundant code --- source/slang/slang-check-conversion.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'source/slang/slang-check-conversion.cpp') diff --git a/source/slang/slang-check-conversion.cpp b/source/slang/slang-check-conversion.cpp index 61d132627..a605928e3 100644 --- a/source/slang/slang-check-conversion.cpp +++ b/source/slang/slang-check-conversion.cpp @@ -1711,6 +1711,8 @@ bool SemanticsVisitor::_coerce( } } + bool result = true; + // Conceptually, we want to treat the conversion as // possible, but report it as ambiguous if we actually // need to reify the result as an expression. @@ -1723,6 +1725,7 @@ bool SemanticsVisitor::_coerce( } *outToExpr = CreateErrorExpr(fromExpr); + result = false; } if (!cachedMethod) @@ -1734,7 +1737,7 @@ bool SemanticsVisitor::_coerce( if (outCost) *outCost = bestCost; - return true; + return result; } else if (overloadContext.bestCandidate) { -- cgit v1.2.3