summaryrefslogtreecommitdiffstats
path: root/tests/bugs
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2024-09-04 13:26:16 -0700
committerGitHub <noreply@github.com>2024-09-04 13:26:16 -0700
commit599dae52e85d2a86bf3cae1ebd0883fedf44a76e (patch)
treef9c807080bfdc9580fea345c45550310b7ac6c9d /tests/bugs
parentddd29057e48a5b309726750e3daf78bfd073038e (diff)
Open existential on arguments after overload resolution. (#4982)
* Open existential on arguments after overload resolution. * Fix. * Update source/slang/slang-check-overload.cpp Co-authored-by: ArielG-NV <159081215+ArielG-NV@users.noreply.github.com> --------- Co-authored-by: ArielG-NV <159081215+ArielG-NV@users.noreply.github.com>
Diffstat (limited to 'tests/bugs')
-rw-r--r--tests/bugs/gh-4467.slang43
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/bugs/gh-4467.slang b/tests/bugs/gh-4467.slang
new file mode 100644
index 000000000..dc97b9890
--- /dev/null
+++ b/tests/bugs/gh-4467.slang
@@ -0,0 +1,43 @@
+//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=CHK): -d3d12 -compute -shaderobj -output-using-type
+//TEST(compute, vulkan):COMPARE_COMPUTE_EX(filecheck-buffer=CHK): -vk -compute -shaderobj -output-using-type
+
+
+// Test that we can synthesize a [mutating] interface requirement from a nonmutating implementation,
+// and the interface requirement signature contains an output interface-typed parameter.
+
+//TEST_INPUT: ubuffer(data=[0 0], stride=4):out,name outputBuffer
+RWStructuredBuffer<int> outputBuffer;
+
+interface IFoo
+{
+ int getVal();
+};
+
+interface IBar
+{
+ [mutating] void method(out IFoo o);
+};
+
+struct FooImpl : IFoo
+{
+ int x;
+ int getVal() { return x; }
+}
+
+struct BarImpl : IBar
+{
+ void method(out IFoo o)
+ {
+ o = FooImpl(1);
+ }
+};
+
+[numthreads(1,1,1)]
+void computeMain()
+{
+ BarImpl bar;
+ IFoo foo;
+ bar.method(foo);
+ // CHK: 1
+ outputBuffer[0] = foo.getVal();
+} \ No newline at end of file