================
@@ -4837,6 +4837,21 @@ static void TryConstructorOrParenListInitialization(
   TryConstructorInitialization(S, Entity, Kind, Args, DestType, DestType,
                                Sequence, /*IsListInit=*/false, IsAggrListInit);
 
+  // Try list initialization if this is HLSL.
+  if (S.getLangOpts().HLSL && Sequence.Failed()) {
+    InitListExpr *ILE = new (S.Context)
+        InitListExpr(S.getASTContext(), Args.front()->getBeginLoc(), Args,
+                     Args.back()->getEndLoc());
+    ILE->setType(S.getASTContext().VoidTy);
+    Args[0] = ILE;
+    // Reset the sequence as normal.
+    Sequence.setSequenceKind(InitializationSequence::NormalSequence);
+    // We don't want the diagnostics to appear if list initialization fails.
+    Sema::TentativeAnalysisScope DisableDiag(S);
+    TryListInitialization(S, Entity, Kind, ILE, Sequence,
+                          /*TreatUnavailableAsInvalid=*/true);
+    return;
+  }
----------------
s-perron wrote:

also, should we have a common function that both the assignment operator and 
the initializer case call? Why don't we call HLSL().tryAggregateInitialization 
from here?

https://github.com/llvm/llvm-project/pull/190089
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to