[PATCH] D76038: PR45000: Use Sema::SetParamDefaultArgument in TransformLambdaExpr
Richard Smith - zygoloid via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Apr 16 14:31:35 PDT 2020
rsmith added inline comments.
================
Comment at: clang/lib/Sema/TreeTransform.h:12162
for (unsigned I = 0, NumParams = NewCallOperator->getNumParams();
I != NumParams; ++I) {
----------------
This logic shouldn't even be here in the first place.. this should all be handled by `SubstParmVarDecl` in `SemaTemplateInstantiate`. It's wrong for `TreeTransform` to be assuming that `TransformFunctionProtoType` will have built new function parameters -- it doesn't do so by default, so in the non-template-instantiation case, this is clobbering the default argument information on the original lambda. And in the template instantiation case, this is clobbering the default argument information (including initialization) that `SubstParmVarDecl` already did.
Please try deleting this loop entirely. If there are still problems (and I think there are: I don't think we handle delayed instantiation for default argument in generic lambdas properly), we should address them by changing how we do default argument instantiation in `SubstParmVarDecl`. In particular, where that function calls `SetParamDefaultArgument` after calling `SubstExpr`, we should presumably instead be calling `setUninstantiatedDefaultArg` on the parameter if it's a parameter of a generic lambda (we still need to instantiate the default argument with the template arguments of the actual lambda call operator).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D76038/new/
https://reviews.llvm.org/D76038
More information about the cfe-commits
mailing list