Debian Codegraph @

clang/test/SemaCXX/warn-unsafe-buffer-usage-c-linkage.cpp

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