summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/bugs/gh-449.slang25
-rw-r--r--tests/bugs/gh-449.slang.expected7
2 files changed, 32 insertions, 0 deletions
diff --git a/tests/bugs/gh-449.slang b/tests/bugs/gh-449.slang
new file mode 100644
index 000000000..9ce678b53
--- /dev/null
+++ b/tests/bugs/gh-449.slang
@@ -0,0 +1,25 @@
+// gh-449.slang
+//TEST:SIMPLE:
+
+// Issue when dealing with binary operations that
+// mix scalars with vectors that have a different
+// element type.
+
+struct S { int dummy; };
+
+void foo(S s);
+
+void main()
+{
+ // This works fine right now. The `uint` gets converted to a
+ // `float`, and then we do the addition.
+ float2 a = float2(1, 2);
+ uint b = 3;
+ foo(a + b);
+
+ // This used to get confused, with the `f` getting converted
+ // to a `uint` before the addition.
+ uint2 u = uint2(1, 2);
+ float f = 3.0;
+ foo(u + f);
+}
diff --git a/tests/bugs/gh-449.slang.expected b/tests/bugs/gh-449.slang.expected
new file mode 100644
index 000000000..2bf08bed2
--- /dev/null
+++ b/tests/bugs/gh-449.slang.expected
@@ -0,0 +1,7 @@
+result code = -1
+standard error = {
+tests/bugs/gh-449.slang(18): error 30019: expected an expression of type 'S', got 'vector<float,2>'
+tests/bugs/gh-449.slang(24): error 30019: expected an expression of type 'S', got 'vector<float,2>'
+}
+standard output = {
+}