[PATCH] D52064: [Sema] Add a note pointing to the first use of an implicit capture
Vedant Kumar via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 13 17:13:16 PDT 2018
vsk added inline comments.
================
Comment at: clang/test/SemaCXX/lambda-expressions.cpp:87
+ (void)^{ // expected-error at +1 {{no matching constructor for initialization of 'const G'}}
+ return [=]{ // expected-error at +1 {{no matching constructor for initialization of 'const G'}}
+ const G* gg = &g; // expected-note {{implicitly capturing 'g', first used here}}
----------------
rsmith wrote:
> Why are these @+1?
A 'no matching constructor' error is present on the line containing "[=]" (pointing to the '=' sign), as well as on the line containing "gg = &g" (pointing to the last 'g').
I'll try to capture that in a neater way.
Stepping back a bit, I think clang does this to make it clear that an implicit capture is part of the problem. It does seem strange to me that we'd emit the same error twice, but according to baseline version of this test, that's the expected behavior. Let me know if I should try and change that diagnostic.
https://reviews.llvm.org/D52064
More information about the cfe-commits
mailing list