[clang] [clang] CTAD: Generate deduction guides for alias templates from non-template explicit deduction guides (PR #96686)
Younan Zhang via cfe-commits
cfe-commits at lists.llvm.org
Sat Jul 6 05:23:16 PDT 2024
================
@@ -3216,6 +3226,44 @@ void DeclareImplicitDeductionGuidesForTypeAlias(
Guides.suppressDiagnostics();
for (auto *G : Guides) {
+ if (auto *DG = dyn_cast<CXXDeductionGuideDecl>(G)) {
+ // The deduction guide is a non-template function decl, we just clone it.
+ auto *FunctionType =
+ SemaRef.Context.getTrivialTypeSourceInfo(DG->getType());
+ FunctionProtoTypeLoc FPTL =
+ FunctionType->getTypeLoc().castAs<FunctionProtoTypeLoc>();
+
+ // Clone the parameters.
+ unsigned ProcessedParamIndex = 0;
+ for (auto *P : DG->parameters()) {
----------------
zyn0217 wrote:
nit: I think we can just use
```cpp
for (unsigned I = 0; N = DG->parameters().size(); I != N; ++I)
```
https://github.com/llvm/llvm-project/pull/96686
More information about the cfe-commits
mailing list