Debian Codegraph @

clang/test/SemaHLSL/matrix_single_subscript_errors.hlsl

raw
1 // RUN: %clang_cc1 -triple dxil-pc-shadermodel6.4-library -finclude-default-header -verify %s
2
3 float2x3 gM;
4
5 void bad_index_type(float f) {
6 gM[f]; // expected-error {{matrix row index is not an integer}}
7 }
8
9 // 2 rows: valid row indices: 0, 1
10 void bad_constant_row_index() {
11 gM[2]; // expected-error {{matrix row index is outside the allowed range}}
12 }
13
14 float4 getMatrix(float3x3 M, int index) {
15 return M[index].rgba; // expected-error {{vector component access exceeds type 'vector<float, 3>' (vector of 3 'float' values)}}
16 }