summaryrefslogtreecommitdiffstats
path: root/source/slang/check.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/check.cpp')
-rw-r--r--source/slang/check.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/source/slang/check.cpp b/source/slang/check.cpp
index 19e349807..c3eb44cfd 100644
--- a/source/slang/check.cpp
+++ b/source/slang/check.cpp
@@ -3011,6 +3011,11 @@ namespace Slang
// because there is no way for overload resolution to pick between them.
if (fstParam.getDecl()->HasModifier<OutModifier>() != sndParam.getDecl()->HasModifier<OutModifier>())
return false;
+
+ // If one parameter is `ref` and the other isn't, then they don't match.
+ //
+ if(fstParam.getDecl()->HasModifier<RefModifier>() != sndParam.getDecl()->HasModifier<RefModifier>())
+ return false;
}
// Note(tfoley): return type doesn't enter into it, because we can't take
@@ -7046,8 +7051,15 @@ namespace Slang
for (UInt pp = 0; pp < paramCount; ++pp)
{
auto paramType = funcType->getParamType(pp);
- if (auto outParamType = paramType->As<OutTypeBase>())
+ if (paramType->As<OutTypeBase>() || paramType->As<RefType>())
{
+ // `out`, `inout`, and `ref` parameters currently require
+ // an *exact* match on the type of the argument.
+ //
+ // TODO: relax this requirement by allowing an argument
+ // for an `inout` parameter to be converted in both
+ // directions.
+ //
if( pp < expr->Arguments.Count() )
{
auto argExpr = expr->Arguments[pp];