Skip to content

Commit 6b6c7e4

Browse files
committed
[clang][Interp][NFC] Test out-of-bounds access on vectors
1 parent 0ff992e commit 6b6c7e4

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

clang/test/AST/Interp/vectors.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@ static_assert(A[1] == 2, ""); // ref-error {{not an integral constant expression
88
static_assert(A[2] == 3, ""); // ref-error {{not an integral constant expression}}
99
static_assert(A[3] == 4, ""); // ref-error {{not an integral constant expression}}
1010

11+
12+
/// FIXME: It would be nice if the note said 'vector' instead of 'array'.
13+
static_assert(A[12] == 4, ""); // ref-error {{not an integral constant expression}} \
14+
// expected-error {{not an integral constant expression}} \
15+
// expected-note {{cannot refer to element 12 of array of 4 elements in a constant expression}}
16+
17+
1118
/// VectorSplat casts
1219
typedef __attribute__(( ext_vector_type(4) )) float float4;
1320
constexpr float4 vec4_0 = (float4)0.5f;

0 commit comments

Comments
 (0)