summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-check-overload.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/slang-check-overload.cpp')
-rw-r--r--source/slang/slang-check-overload.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/source/slang/slang-check-overload.cpp b/source/slang/slang-check-overload.cpp
index f949e2632..e0dbc7e08 100644
--- a/source/slang/slang-check-overload.cpp
+++ b/source/slang/slang-check-overload.cpp
@@ -1196,8 +1196,25 @@ Expr* SemanticsVisitor::CompleteOverloadCandidate(
{
// If the subscript decl has a setter,
// then the call is an l-value if base is l-value.
+ //
+ // If Ptr<T, Access> we only need to check for ReadWrite
+ // Access (if ReadWrite result is an LValue. By default a
+ // Ptr<...> is Read-only (unresolved generic argument & Access::Read).
if (auto base = GetBaseExpr(baseExpr))
{
+ if (auto ptrTypeBase = as<PtrTypeBase>(base->type))
+ {
+ auto accessQualifier =
+ as<ConstantIntVal>(ptrTypeBase->getAccessQualifier());
+ if (!accessQualifier ||
+ AccessQualifier(accessQualifier->getValue()) ==
+ AccessQualifier::ReadWrite)
+ {
+ callExpr->type.isLeftValue = true;
+ }
+ break;
+ }
+
if (base->type.isLeftValue)
{
callExpr->type.isLeftValue = true;