[clang] [Clang][Sema] Fix wrong initialization kind when handling initializing structured bindings from an array with direct-list-initialization (PR #124793)

Shafik Yaghmour via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 28 13:57:12 PST 2025


================
@@ -4861,8 +4861,9 @@ static void TryListInitialization(Sema &S,
             S.Context.hasSameUnqualifiedType(SubInit[0]->getType(), DestType) &&
             "Deduced to other type?");
         TryArrayCopy(S,
-                     InitializationKind::CreateCopy(Kind.getLocation(),
-                                                    InitList->getLBraceLoc()),
+                     InitializationKind::CreateDirect(Kind.getLocation(),
+                                                      InitList->getLBraceLoc(),
+                                                      InitList->getRBraceLoc()),
----------------
shafik wrote:

This looks correct to me as well, can we come up w/ a test case where it makes a difference though.

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


More information about the cfe-commits mailing list