[clang] [HLSL] Remove support for constructors for user defined structs (PR #190089)

Sarah Spall via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 9 12:32:12 PDT 2026


================
@@ -5913,8 +5878,10 @@ bool SemaHLSL::transformInitList(const InitializedEntity &Entity,
   }
   size_t ExpectedSize = ILT.DestTypes.size();
   size_t ActualSize = ILT.ArgExprs.size();
-  if (ExpectedSize == 0 && ActualSize == 0)
+  if (ExpectedSize == 0 && ActualSize == 0) {
+    Init->resizeInits(Ctx, 0);
----------------
spall wrote:

To remove any content of the InitListExpr, so the InitListExpr will succeed in a case such as this. 
```
EmptyStruct E1 = {};
EmptyStruct E = {E1};
```
This is expected to be changed in later work, but is necessary for removing constructors at this time.
https://github.com/llvm/llvm-project/issues/188309#issuecomment-4129877776

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


More information about the cfe-commits mailing list