yum-mirror/slang

Making it easier to work with shaders

git clone https://git.yummers.dev/yum-mirror/slang

Jay KwakReplace the word stdlib or standard-library with core-module for source code (#5415)b7a619b45

master
1.1 KiB34 linesraw
1// bad-operator-call.slang
2
3//DIAGNOSTIC_TEST(windows):SIMPLE(filecheck=CHECK):
4
5// Test that bad calls to operators produce reasonable diagnostic messages.
6
7// Note: This test is currently Windows-only because our Linux builds
8// seem to print references to the core module code with paths that don't
9// match the Windows build (which generated our baseline).
10
11struct S {}
12
13void test()
14{
15	int a;
16    S b;
17    // CHECK:{{.*}}.slang(18): error {{.*}}:
18    a += b;
19    // CHECK:{{.*}}.slang(20): error {{.*}}: no overload for '+' applicable to arguments of type (int, S)
20    a = a + b;
21    // CHECK:{{.*}}.slang(22): error {{.*}}: no overload for '~' applicable to arguments of type (S)
22	a = ~b;
23
24	vector<int, 4> c;
25    vector<float, 3> d;
26    // CHECK:{{.*}}.slang(27): error {{.*}}: argument passed to parameter '0' must be l-value.
27	a += c;
28
29    c = a + c;
30    // CHECK:{{.*}}.slang(31): error {{.*}}: no overload for '+=' applicable to arguments of type (vector<float,3>, vector<int,4>)
31    d += c;
32    // CHECK:{{.*}}.slang(33): error {{.*}}: no overload for '+' applicable to arguments of type (vector<int,4>, vector<float,3>)
33	d = c + d;
34}