Commit 6f241e3
authored
[Clang][Sema] Fix wrong initialization kind when handling initializing structured bindings from an array with direct-list-initialization (#124793)
In 377257f, 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};
```1 parent e0a21e2 commit 6f241e3
File tree
3 files changed
+26
-26
lines changed- clang
- docs
- lib/Sema
- test/SemaCXX
3 files changed
+26
-26
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
151 | 151 | | |
152 | 152 | | |
153 | 153 | | |
| 154 | + | |
| 155 | + | |
154 | 156 | | |
155 | 157 | | |
156 | 158 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4862 | 4862 | | |
4863 | 4863 | | |
4864 | 4864 | | |
| 4865 | + | |
| 4866 | + | |
| 4867 | + | |
4865 | 4868 | | |
4866 | | - | |
4867 | | - | |
| 4869 | + | |
| 4870 | + | |
| 4871 | + | |
4868 | 4872 | | |
4869 | 4873 | | |
4870 | 4874 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
200 | 200 | | |
201 | 201 | | |
202 | 202 | | |
203 | | - | |
204 | | - | |
| 203 | + | |
| 204 | + | |
205 | 205 | | |
206 | 206 | | |
207 | | - | |
208 | | - | |
209 | | - | |
| 207 | + | |
| 208 | + | |
210 | 209 | | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
217 | 213 | | |
218 | | - | |
219 | | - | |
220 | | - | |
221 | | - | |
222 | 214 | | |
223 | | - | |
| 215 | + | |
224 | 216 | | |
225 | | - | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
226 | 221 | | |
227 | | - | |
228 | | - | |
229 | | - | |
230 | | - | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
231 | 225 | | |
232 | 226 | | |
233 | | - | |
234 | | - | |
235 | | - | |
| 227 | + | |
| 228 | + | |
236 | 229 | | |
| 230 | + | |
237 | 231 | | |
0 commit comments