[clang] [clang][Interp] Zero-init remaining string literal elements (PR #66862)
Shafik Yaghmour via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 28 10:45:46 PDT 2023
================
@@ -350,3 +350,22 @@ namespace ZeroInit {
static_assert(b.f[0] == 0.0, "");
static_assert(b.f[1] == 0.0, "");
}
+
+namespace StringZeroFill {
+ struct A {
+ char c[12];
+ };
+ constexpr A a = { "abc" };
+ static_assert(a.c[0] == 'a', "");
+ static_assert(a.c[1] == 'b', "");
+ static_assert(a.c[2] == 'c', "");
+ static_assert(a.c[3] == '\0', "");
----------------
shafik wrote:
Shouldn't we just test all the bytes? It is small enough.
https://github.com/llvm/llvm-project/pull/66862
More information about the cfe-commits
mailing list