Commit 32aa7d8
authored
[clang] Fix CTAD not work for C++ explicit type conversion (functional annotation). (#75779)
This fixes #64347.
The CTAD for an aggregate class is missing to handle the explicit type
conversion case, e.g. `TemplateFooClass(1, 2);`. Per C++ expr.type.conv
p1, the deduced type is the return type of the deduction guide selected
by the CTAD for the reminder.
In the deduction implementation
`DeduceTemplateSpecializationFromInitializer`, the parenthesized
express-list case relies on the `ParenListExpr` parameter (default is
nullptr), the AST `ParenListExpr` node is not built for all variant
initializer cases (`BuildCXXTypeConstructorExpr`, `BuildCXXNew` etc),
thus the deduction doesn't perform for these cases. This patch fixes it
by removing the `ParenListExpr` and using the `Inits` instead (which
also simplifies the interface and implementation).1 parent 0d3d445 commit 32aa7d8
File tree
5 files changed
+31
-7
lines changed- clang
- docs
- include/clang/Sema
- lib/Sema
- test/SemaCXX
5 files changed
+31
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
686 | 686 | | |
687 | 687 | | |
688 | 688 | | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
689 | 692 | | |
690 | 693 | | |
691 | 694 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9354 | 9354 | | |
9355 | 9355 | | |
9356 | 9356 | | |
9357 | | - | |
9358 | | - | |
| 9357 | + | |
9359 | 9358 | | |
9360 | 9359 | | |
9361 | 9360 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12954 | 12954 | | |
12955 | 12955 | | |
12956 | 12956 | | |
12957 | | - | |
| 12957 | + | |
12958 | 12958 | | |
12959 | 12959 | | |
12960 | 12960 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10561 | 10561 | | |
10562 | 10562 | | |
10563 | 10563 | | |
10564 | | - | |
| 10564 | + | |
10565 | 10565 | | |
10566 | 10566 | | |
10567 | 10567 | | |
| |||
10792 | 10792 | | |
10793 | 10793 | | |
10794 | 10794 | | |
10795 | | - | |
10796 | | - | |
10797 | | - | |
| 10795 | + | |
| 10796 | + | |
| 10797 | + | |
| 10798 | + | |
| 10799 | + | |
| 10800 | + | |
10798 | 10801 | | |
10799 | 10802 | | |
10800 | 10803 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
0 commit comments