summaryrefslogtreecommitdiff
path: root/source/slang/slang-check-conversion.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/slang-check-conversion.cpp')
-rw-r--r--source/slang/slang-check-conversion.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/source/slang/slang-check-conversion.cpp b/source/slang/slang-check-conversion.cpp
index 85c508d41..4b781643e 100644
--- a/source/slang/slang-check-conversion.cpp
+++ b/source/slang/slang-check-conversion.cpp
@@ -461,7 +461,19 @@ namespace Slang
{
if(outToExpr)
{
- getSink()->diagnose(fromExpr->loc, Diagnostics::typeMismatch, toType, fromExpr->type);
+ // As a special case, if the expression we are trying to convert
+ // from is overloaded (implying an ambiguous reference), then we
+ // will try to produce a more appropriately tailored error message.
+ //
+ auto fromType = fromExpr->type.type;
+ if( as<OverloadGroupType>(fromType) )
+ {
+ diagnoseAmbiguousReference(fromExpr);
+ }
+ else
+ {
+ getSink()->diagnose(fromExpr->loc, Diagnostics::typeMismatch, toType, fromExpr->type);
+ }
}
return false;
}