Skip to content

Commit f534ebe

Browse files
author
mxms
committed
Fix test for unsafe enum
1 parent 35207ea commit f534ebe

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

clang/test/SemaCXX/warn-unsafe-buffer-usage-array.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,10 @@ void constant_enum_safe() {
5555
}
5656

5757
void constant_enum_unsafe(FooEnum e) {
58-
int buffer[FooEnum::D] = { 0, 1, 2 };
59-
buffer[e] = 0; // expected-warning{{unsafe buffer access}}
58+
int buffer[FooEnum::D] = { 0, 1, 2 }; // expected-warning{{'buffer' is an unsafe buffer that does not perform bounds checks}}
59+
// expected-note@-1{{change type of 'buffer' to 'std::array' to label it for hardening}}
60+
61+
buffer[e] = 0; // expected-note{{used in buffer access here}}
6062
}
6163

6264
void constant_id_string(unsigned idx) {

0 commit comments

Comments
 (0)