blob: 6c134098f87dfb98d17bd758206c4fde9f641dca (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
// RUN: %clang_cc1 -std=c++20 -Wunsafe-buffer-usage -fsafe-buffer-usage-suggestions -verify %s
extern "C" {
void foo(int *ptr) {
ptr[5] = 10; // expected-warning{{unsafe buffer access}}
}
void bar(int *ptr);
struct c_struct {
char *name;
};
}
void bar(int *ptr) {
ptr[5] = 10; // expected-warning{{unsafe buffer access}}
}
void call_foo(int *p) {
foo(p);
struct c_struct str;
str.name[7] = 9; // expected-warning{{unsafe buffer access}}
bar(p);
}
|