[clang] [clang][analyzer] Add StoreToImmutable checker (PR #150417)
Endre Fülöp via cfe-commits
cfe-commits at lists.llvm.org
Tue Jul 29 11:58:10 PDT 2025
================
@@ -8,6 +8,7 @@ void test_global_const() {
}
// String literal
+// NOTE: This only works in C++, not in C, as the analyzer treats string literals as non-const char arrays in C mode.
----------------
gamesh411 wrote:
The const keyword was introduced in the ANSI C standard (C89/C90), so from that standard on, we should have string literals as const char arrays.
And according to the docs: the latest [``clang defaults to C17 by default``](https://clang.llvm.org/docs/UsersManual.html), so this seems to be a bug to me.
https://github.com/llvm/llvm-project/pull/150417
More information about the cfe-commits
mailing list