Index: clang/test/SemaCXX/warn-unsafe-buffer-usage-debug.cpp =================================================================== --- clang/test/SemaCXX/warn-unsafe-buffer-usage-debug.cpp +++ clang/test/SemaCXX/warn-unsafe-buffer-usage-debug.cpp @@ -78,3 +78,22 @@ auto [x, y] = a; x = 9; } + +void test_claim_use_multiple() { + int *a = new int[8]; // expected-warning{{'a' is an unsafe pointer used for buffer access}} + a[6] = 9; // expected-note{{used in buffer access here}} + a++; // expected-note{{used in pointer arithmetic here}} \ + // debug-note{{safe buffers debug: failed to produce fixit for 'a' : has an unclaimed use}} +} + +struct S +{ + int *x; +}; + +S f() { return S{new int[4]}; } + +void test_struct_claim_use() { + auto [x] = f(); + x[6] = 8; // expected-warning{{unsafe buffer access}} +}