summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2024-08-18 10:37:41 -0700
committerGitHub <noreply@github.com>2024-08-18 10:37:41 -0700
commitca5d303748517889a5d5849224671fa8945e1c6d (patch)
treef25395b3b7227be3abec2da89114f85498b5f644
parent25bc5a3ada5a2404f25ecf2de7d035ba60cd9fdf (diff)
Make sure to resolve overloaded expr for call args. (#4864)
-rw-r--r--source/slang/slang-check-expr.cpp2
-rw-r--r--tests/bugs/gh-4863.slang36
2 files changed, 37 insertions, 1 deletions
diff --git a/source/slang/slang-check-expr.cpp b/source/slang/slang-check-expr.cpp
index 561d17c00..965d25bd5 100644
--- a/source/slang/slang-check-expr.cpp
+++ b/source/slang/slang-check-expr.cpp
@@ -2652,7 +2652,7 @@ namespace Slang
// Next check the argument expressions
for (auto & arg : expr->arguments)
{
- arg = CheckTerm(arg);
+ arg = CheckExpr(arg);
}
// if the expression is '&&' or '||', we will convert it
diff --git a/tests/bugs/gh-4863.slang b/tests/bugs/gh-4863.slang
new file mode 100644
index 000000000..e1f4e1d2d
--- /dev/null
+++ b/tests/bugs/gh-4863.slang
@@ -0,0 +1,36 @@
+//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=BUFFER):-compute -output-using-type
+//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=BUFFER):-vk -compute -output-using-type
+
+//TEST_INPUT:ubuffer(data=[0 0 0 0 0], stride=4):out,name=outputBuffer
+RWStructuredBuffer<int> outputBuffer;
+
+interface IFoo
+{
+ property float bar1 {get; set;}
+};
+
+struct Foo : IFoo
+{
+ uint4 data = 0;
+ property float bar1
+ {
+ get { return asfloat(data.w); }
+ set { data.w = asuint(newValue); }
+ }
+};
+
+void doThing(inout Foo foo, uint2 ipos)
+{
+ foo.bar1 = 2;
+ foo.bar1 += 1.0f;
+}
+
+[shader("compute")]
+[numthreads(1, 1, 1)]
+void computeMain(uint2 ipos : SV_DispatchThreadID)
+{
+ Foo foo;
+ doThing(foo, ipos);
+ // BUFFER: 3
+ outputBuffer[0] = (int)foo.bar1;
+} \ No newline at end of file