[PATCH] D76038: PR45000: Use Sema::SetParamDefaultArgument in TransformLambdaExpr

2020-04-17 Thread Aaron Puchert via Phabricator via cfe-commits
aaronpuchert added a comment. Let's have a look at an example. Do we allow this? template int x = [](T = T()){ return 0; }(args...); template int x; // Uses default argument int() = 0. struct S { S(int); }; template int x; // Default argument not well-formed, but not needed. Curr

[PATCH] D76038: PR45000: Use Sema::SetParamDefaultArgument in TransformLambdaExpr

2020-04-16 Thread Aaron Puchert via Phabricator via cfe-commits
aaronpuchert marked an inline comment as done. aaronpuchert added inline comments. Comment at: clang/lib/Sema/TreeTransform.h:12162 for (unsigned I = 0, NumParams = NewCallOperator->getNumParams(); I != NumParams; ++I) { aaronpuchert wrote: > rsmith

[PATCH] D76038: PR45000: Use Sema::SetParamDefaultArgument in TransformLambdaExpr

2020-04-16 Thread Aaron Puchert via Phabricator via cfe-commits
aaronpuchert marked 2 inline comments as done. aaronpuchert added inline comments. Comment at: clang/lib/Sema/TreeTransform.h:12162 for (unsigned I = 0, NumParams = NewCallOperator->getNumParams(); I != NumParams; ++I) { rsmith wrote: > rsmith wrote:

[PATCH] D76038: PR45000: Use Sema::SetParamDefaultArgument in TransformLambdaExpr

2020-04-16 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith added inline comments. Comment at: clang/lib/Sema/TreeTransform.h:12162 for (unsigned I = 0, NumParams = NewCallOperator->getNumParams(); I != NumParams; ++I) { rsmith wrote: > This logic shouldn't even be here in the first place.. this should

[PATCH] D76038: PR45000: Use Sema::SetParamDefaultArgument in TransformLambdaExpr

2020-04-16 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
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

[PATCH] D76038: PR45000: Use Sema::SetParamDefaultArgument in TransformLambdaExpr

2020-04-15 Thread Aaron Puchert via Phabricator via cfe-commits
aaronpuchert updated this revision to Diff 257938. aaronpuchert added a comment. Add test case, loosely based on that in the bug report. By choosing a conversion that should error out we can detect the issue in a pure frontend test. However, we would expect the error only once. Further investig

[PATCH] D76038: PR45000: Use Sema::SetParamDefaultArgument in TransformLambdaExpr

2020-04-15 Thread Aaron Puchert via Phabricator via cfe-commits
aaronpuchert added a comment. I tested a bit more and there is a problem: some errors now appear twice, and I think they shouldn't. template void f(int x = [](T x = nullptr) -> int { return x; }()); void g() { f(); } The error is expected, but it should only appear once: :2:23: err

[PATCH] D76038: PR45000: Use Sema::SetParamDefaultArgument in TransformLambdaExpr

2020-04-13 Thread Aaron Puchert via Phabricator via cfe-commits
aaronpuchert added a comment. In D76038#1978667 , @mstorsjo wrote: > Ping - any update on this one? Are you waiting on @rsmith for input on where > to place a testcase? No, I just didn't get around to writing the test yet, thanks for reminding me. Alth

[PATCH] D76038: PR45000: Use Sema::SetParamDefaultArgument in TransformLambdaExpr

2020-04-13 Thread Martin Storsjö via Phabricator via cfe-commits
mstorsjo added a comment. Ping - any update on this one? Are you waiting on @rsmith for input on where to place a testcase? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D76038/new/ https://reviews.llvm.org/D76038 ___

[PATCH] D76038: PR45000: Use Sema::SetParamDefaultArgument in TransformLambdaExpr

2020-03-11 Thread Aaron Puchert via Phabricator via cfe-commits
aaronpuchert added a comment. Seems the same issue in `Sema::SubstParmVarDecl` was fixed in rGdc40b618cf397df7369406b3f61e91ccb57fb9f6 . Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.

[PATCH] D76038: PR45000: Use Sema::SetParamDefaultArgument in TransformLambdaExpr

2020-03-11 Thread Aaron Puchert via Phabricator via cfe-commits
aaronpuchert planned changes to this revision. aaronpuchert added a comment. In D76038#1918571 , @aaronpuchert wrote: > @rsmith, should I put a testcase under `test/SemaTemplate/`, perhaps as > `instantiate-lambda.cpp`? I'll probably put it into `test/

[PATCH] D76038: PR45000: Use Sema::SetParamDefaultArgument in TransformLambdaExpr

2020-03-11 Thread Aaron Puchert via Phabricator via cfe-commits
aaronpuchert added a comment. @rsmith, should I put a testcase under `test/SemaTemplate/`, perhaps as `instantiate-lambda.cpp`? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D76038/new/ https://reviews.llvm.org/D76038 ___

[PATCH] D76038: PR45000: Use Sema::SetParamDefaultArgument in TransformLambdaExpr

2020-03-11 Thread Aaron Puchert via Phabricator via cfe-commits
aaronpuchert created this revision. aaronpuchert added a reviewer: rsmith. Herald added a project: clang. Herald added a subscriber: cfe-commits. We have to properly initialize from the given initialization expression to make types match. Repository: rG LLVM Github Monorepo https://reviews.ll