[clang] [HLSL] Enable InitList code to handle zero sized structs (PR #160355)

Deric C. via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 23 11:35:35 PDT 2025


================
@@ -985,3 +995,35 @@ void case18() {
 void case19(Unnamed U) {
   TwoInts TI = {U, 1};
 }
+
+// InitList with Empty Struct on LHS
+// CHECK-LABEL: case20
+// CHECK: [[E:%.*]] = alloca %struct.Empty, align 1
+// CHECK-NEXT: call void @llvm.memcpy.p0.p0.i32(ptr align 1 [[E]], ptr align 1 [[ConstE]], i32 1, i1 false)
----------------
Icohedron wrote:

Why is the length of the memcpy for an empty struct 1 byte instead of 0 bytes?

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


More information about the cfe-commits mailing list