There was an error while loading. Please reload this page.
Compiling the following code with -Wunsafe-buffer-usage unexpectedly emits a warning:
-Wunsafe-buffer-usage
constexpr char kAbc[] = "abc"; static_assert(kAbc[3] == '\0'); // OK static_assert("abc"[3] == '\0'); // OK void f() { static_assert(kAbc[3] == '\0'); // OK static_assert("abc"[3] == '\0'); // WARNING }
Live repro: https://godbolt.org/z/c6jhdvPTb