https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93842
kuzniar95 at o2 dot pl changed:
What|Removed |Added
Resolution|--- |INVALID
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93842
kuzniar95 at o2 dot pl changed:
What|Removed |Added
Status|RESOLVED|UNCONFIRMED
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93842
--- Comment #6 from kuzniar95 at o2 dot pl ---
P.S. odr_use function signature should be:
void odr_use(const char&);
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93842
kuzniar95 at o2 dot pl changed:
What|Removed |Added
Resolution|--- |INVALID
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93842
--- Comment #4 from kuzniar95 at o2 dot pl ---
I meant that dropping constness:
char ch = '='; // OK
results in an error:
lambda.cpp: In lambda function:
lambda.cpp:4:23: error: ‘ch’ is not captured
4 | [](auto) { return ch; }; // OK
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93842
--- Comment #3 from kuzniar95 at o2 dot pl ---
@Richard Biener changing it to
char const ch = '='; // NOT OK
doesn't solve the issue. Interestingly dropping constness:
char ch = '='; // OK
works.
So we are onto something - both const and
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93842
--- Comment #2 from Martin Liška ---
Confirmed that clang really rejects the code:
$ clang pr93842.cc -Wunused -std=c++14 -c
pr93842.cc:4:20: error: variable 'ch' cannot be implicitly captured in a lambda
with no capture-default specified
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93842
Richard Biener changed:
What|Removed |Added
Keywords||accepts-invalid, diagnostic
---