summaryrefslogtreecommitdiff
path: root/tests/bugs
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2024-03-19 18:01:42 -0700
committerGitHub <noreply@github.com>2024-03-19 18:01:42 -0700
commit1ee1688a70f1c099b24b5d479b4f08e3cf3ae410 (patch)
tree88f857aeb0a94c09a9351e39b0971329625fddc0 /tests/bugs
parent05f403be96f0d991a3ef949e5a6a6fb3b416e1ff (diff)
Fix type checking for constructors in generic interfaces. (#3799)
Diffstat (limited to 'tests/bugs')
-rw-r--r--tests/bugs/gh-3792.slang25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/bugs/gh-3792.slang b/tests/bugs/gh-3792.slang
new file mode 100644
index 000000000..6b6a7451c
--- /dev/null
+++ b/tests/bugs/gh-3792.slang
@@ -0,0 +1,25 @@
+//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=BUF): -shaderobj -output-using-type
+
+//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer
+
+interface From<X> {
+ __init(const X x);
+}
+extension float: From<float> {
+ __init(const float x) { this = x; }
+}
+T test<T : From<float>>(float v)
+{
+ T u;
+ u = T(5.0f);
+ return u;
+}
+
+RWStructuredBuffer<float> outputBuffer;
+[numthreads(1,1,1)]
+void computeMain()
+{
+ float v = test<float>(5.0);
+ //BUF: 5.0
+ outputBuffer[0] = v;
+} \ No newline at end of file