Debian Codegraph @

clang/test/SemaHLSL/ArrayAssignable_errors.hlsl

raw
1 // RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -verify
2
3 void test_wrong_size1() {
4 int Arr[2] = {0, 1};
5 int Arr2[3] = {1, 2, 0};
6 Arr = Arr2;
7 // expected-error@-1 {{assigning to 'int[2]' from incompatible type 'int[3]'}}
8 }
9
10 void test_wrong_size2() {
11 int Arr[2] = {0, 1};
12 int Arr2[3] = {1, 2, 0};
13 Arr2 = Arr;
14 // expected-error@-1 {{assigning to 'int[3]' from incompatible type 'int[2]'}}
15 }
16
17 void test_wrong_size3() {
18 int Arr[2][2] = {{0, 1}, {2, 3}};
19 int Arr2[2] = {4, 5};
20 Arr = Arr2;
21 // expected-error@-1 {{assigning to 'int[2][2]' from incompatible type 'int[2]'}}
22 }
23
24 void test_wrong_size4() {
25 int Arr[2][2] = {{0, 1}, {2, 3}};
26 int Arr2[2] = {4, 5};
27 Arr2 = Arr;
28 // expected-error@-1 {{assigning to 'int[2]' from incompatible type 'int[2][2]'}}
29 }