aaron.ballman added inline comments.

Comment at: test/SemaCXX/warn-unused-lambda-capture.cpp:86
+  auto explicit_by_value_unused_sizeof = [i] { return sizeof(i); }; // 
expected-warning{{lambda capture 'i' is not required to be captured for use in 
an unevaluated context}}
+  auto explicit_by_value_unused_decltype = [i] { decltype(i) j = 0; }; // 
expected-warning{{lambda capture 'i' is not used}}
malcolm.parsons wrote:
> aaron.ballman wrote:
> > malcolm.parsons wrote:
> > > I don't know why the unevaluated context warning didn't work here.
> > Hmm, it should have, come to think of it. I don't think that's an odr-use 
> > (when I get near a standard, I'll double-check), and it is unevaluated. 
> > Worth poking at.
> The unevaluated context warning worked on line 38 where it's not in a 
> template and on line 85 where it's `sizeof` instead of `decltype`.
> Somehow the template instantiation is avoiding some work when the capture 
> doesn't have a dependent type.
That might make some degree of sense. Btw, I did double check, and it's 
definitely not an odr-use.

I think this edge case can be handled in a follow-up patch if you want to get 
the primary work in. If you'd prefer to have it fixed for the initial commit, 
that's obviously fine too.


cfe-commits mailing list

Reply via email to