[all-commits] [llvm/llvm-project] 6f241e: [Clang][Sema] Fix wrong initialization kind when h...

Yanzuo Liu via All-commits all-commits at lists.llvm.org
Fri Feb 7 22:32:09 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 6f241e36831927e3aea113cfc017c34fdeda340a
      https://github.com/llvm/llvm-project/commit/6f241e36831927e3aea113cfc017c34fdeda340a
  Author: Yanzuo Liu <zwuis at outlook.com>
  Date:   2025-02-08 (Sat, 08 Feb 2025)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/lib/Sema/SemaInit.cpp
    M clang/test/SemaCXX/cxx1z-decomposition.cpp

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

In 377257f063c, elements of structured bindings are copy-initialized.
They should be direct-initialized because the form of the initializer of
the whole structured bindings is a direct-list-initialization.

> [dcl.struct.bind]/1:
> ... and each element is copy-initialized or direct-initialized from
the corresponding element of the assignment-expression as specified by
the form of the initializer. ...

For example,

```cpp
  int arr[2]{};
  // elements of `[a, b]` should be direct-initialized
  auto [a, b]{arr};
```



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list