[all-commits] [llvm/llvm-project] 32aa7d: [clang] Fix CTAD not work for C++ explicit type co...
Haojian Wu via All-commits
all-commits at lists.llvm.org
Tue Dec 19 05:35:51 PST 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 32aa7d823c8ae7183e65da2f29ed08a84d6a1b6b
https://github.com/llvm/llvm-project/commit/32aa7d823c8ae7183e65da2f29ed08a84d6a1b6b
Author: Haojian Wu <hokein.wu at gmail.com>
Date: 2023-12-19 (Tue, 19 Dec 2023)
Changed paths:
M clang/docs/ReleaseNotes.rst
M clang/include/clang/Sema/Sema.h
M clang/lib/Sema/SemaDecl.cpp
M clang/lib/Sema/SemaInit.cpp
A clang/test/SemaCXX/ctad.cpp
Log Message:
-----------
[clang] Fix CTAD not work for C++ explicit type conversion (functional annotation). (#75779)
This fixes https://github.com/llvm/llvm-project/issues/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).
More information about the All-commits
mailing list