[clang] [clang] Fix CTAD not work for function-type and array-type arguments. (PR #78159)
Haojian Wu via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 15 12:21:43 PST 2024
================
@@ -2587,15 +2587,17 @@ struct ConvertConstructorToDeductionGuideTransform {
: ParamTy->isRValueReferenceType() ? VK_XValue
: VK_PRValue);
}
-
- ParmVarDecl *NewParam = ParmVarDecl::Create(SemaRef.Context, DC,
- OldParam->getInnerLocStart(),
- OldParam->getLocation(),
- OldParam->getIdentifier(),
- NewDI->getType(),
- NewDI,
- OldParam->getStorageClass(),
- NewDefArg.get());
+ // Handle arrays and functions decay.
+ auto NewType = NewDI->getType();
+ if (NewType->isArrayType())
+ NewType = SemaRef.Context.getArrayDecayedType(NewType);
+ else if (NewType->isFunctionType())
+ NewType = SemaRef.Context.getPointerType(NewType);
----------------
hokein wrote:
Good point, thanks. I was not aware of this API.
https://github.com/llvm/llvm-project/pull/78159
More information about the cfe-commits
mailing list