bolt/deps/llvm-18.1.8/clang/test/SemaCXX/warn-unsafe-buffer-usage-fixits-parm-main.cpp
2025-02-14 19:21:04 +01:00

13 lines
629 B
C++

// RUN: %clang_cc1 -std=c++20 -Wno-all -Wunsafe-buffer-usage -fcxx-exceptions -fsafe-buffer-usage-suggestions -verify %s
// RUN: %clang_cc1 -std=c++20 -Wunsafe-buffer-usage -fcxx-exceptions -fdiagnostics-parseable-fixits -fsafe-buffer-usage-suggestions %s 2>&1 | FileCheck %s
// We do not fix parameters of the `main` function
// CHECK-NOT: fix-it:
// main function
int main(int argc, char *argv[]) { // expected-warning{{'argv' is an unsafe pointer used for buffer access}}
char tmp;
tmp = argv[5][5]; // expected-note{{used in buffer access here}} \
expected-warning{{unsafe buffer access}}
}