[clang] [HLSL] Implement HLSL intialization list support (PR #123141)

Chris B via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 14 13:10:18 PST 2025


================
@@ -1462,6 +1462,14 @@ void CXXRecordDecl::addedMember(Decl *D) {
     if (Using->getDeclName().getCXXOverloadedOperator() == OO_Equal)
       data().HasInheritedAssignment = true;
   }
+
+  // HLSL: All user-defined data types are aggregates and use aggregate
+  // initialization. This _needs_ to change in the future. There are two
+  // relevant HLSL feature proposals that will depend on this changing:
+  // * 0005-strict-initializer-lists.md
+  // * https://github.com/microsoft/hlsl-specs/pull/325
+  if (getLangOpts().HLSL)
+    data().Aggregate = data().UserDeclaredSpecialMembers == 0;
----------------
llvm-beanz wrote:

Yea... I'll update the comment too. We can't strictly use `implicit` because some of the implicit types do behave like aggregates.

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


More information about the cfe-commits mailing list