xref: /llvm-project/clang/test/SemaHLSL/ArrayAssignable_errors.hlsl (revision d8df118545bf0aff3b03d923ca1aa205e7e74f43)
1// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -verify
2
3void 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
10void 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
17void 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
24void 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}
30