[clang] [clang][CodeGen] Check initializer of zero-size fields for nullptr (PR #109271)
Michael Buch via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 19 04:27:15 PDT 2024
================
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 %s -emit-llvm -triple x86_64-linux-gnu -o - | FileCheck %s --check-prefixes=CHECK
+// RUN: %clang_cc1 -x c++ %s -emit-llvm -triple x86_64-linux-gnu -o - | FileCheck %s --check-prefixes=CHECK-CXX
+
+union Foo {
+ struct Empty {} val;
+};
+
+union Foo foo = {};
+
+// CHECK: @foo = {{.*}}global %union.Foo undef, align 1
----------------
Michael137 wrote:
Does this seem reasonable to you @efriedma-quic? Essentially this is treated as if we had written:
```
union Foo {
[[no_unique_address]] struct Empty {} val;
};
union Foo foo = {};
```
https://github.com/llvm/llvm-project/pull/109271
More information about the cfe-commits
mailing list