[clang] [clang][CodeGen] Check initializer of zero-size fields for nullptr (PR #109271)

Eli Friedman via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 19 14:05:38 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
----------------
efriedma-quic wrote:

Generated code seems okay.  I mean, it's the same thing we've always generated for similar constructs.  I'd prefer to integrate this into some existing codegen test if we can, though...

https://github.com/llvm/llvm-project/pull/109271


More information about the cfe-commits mailing list