================ @@ -0,0 +1,17 @@ +// RUN: %clang_cc1 -std=c++20 -Wno-everything -Wunsafe-buffer-usage \ +// RUN: -fsafe-buffer-usage-suggestions \ +// RUN: -verify %s + +void char_literal() { + if ("abc"[2] == 'c') + return; + if ("def"[3] == '0') + return; +} + +void const_size_buffer_arithmetic() { + char kBuf[64] = {}; + const char* p = kBuf + 1; +} + +// expected-no-diagnostics ---------------- haoNoQ wrote:
Extreme nitpicking: I usually put those on top of the file because otherwise I'd be super confused where all those expected warnings are at. We also really don't want it to end up in the middle of the file if folks add more code at the bottom without reading the comment. https://github.com/llvm/llvm-project/pull/92432 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits