[PATCH] D36572: Implemented P0409R2 - Allow lambda capture [=, this]
Hamza Sood via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 11 02:45:24 PDT 2017
hamzasood added inline comments.
================
Comment at: test/FixIt/fixit-cxx0x.cpp:57
(void)[&, &i, &i]{}; // expected-error 2{{'&' cannot precede a capture when the capture default is '&'}}
- (void)[=, this]{ this->g(5); }; // expected-error{{'this' cannot be explicitly captured}}
(void)[i, i]{ }; // expected-error{{'i' can appear only once in a capture list}}
----------------
rjmccall wrote:
> hamzasood wrote:
> > rjmccall wrote:
> > > hamzasood wrote:
> > > > rjmccall wrote:
> > > > > Shouldn't you only be accepting this in C++2a mode?
> > > > I'm not sure what the system is with allowing future language features as extensions, but I noticed that [*this] capture is allowed as an extension pre-C++17 so I figured it would make sense for [=, this] to also be allowed as an extension (since the proposal mentions how it's meant to increase code clarify in the presence of [*this]).
> > > Surely there should at least be an on-by-default extension warning? The behavior we're using sounds a lot more like we're treating this as a bug-fix in the standard than a new feature. Richard, can you weigh in here?
> > The extension warning for this (ext_equals_this_lambda_capture_cxx2a) is on by default.
> Why did the diagnostic disappear from this file, then?
That file is for FixIt hints, which I don't think make much sense for an extension warning (and I couldn't find any other extension warnings that offer FixIt hints)
https://reviews.llvm.org/D36572
More information about the cfe-commits
mailing list