https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93842

kuzniar95 at o2 dot pl changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #8 from kuzniar95 at o2 dot pl ---
I've discovered that turning:

[](auto) { odr_use(ch); };

into:

[](auto) { odr_use(ch); }(123);


finally triggers a longed-for error:

------
lambda.cpp: In instantiation of ‘main()::<lambda(auto:2)> [with auto:2 = int]’:
lambda.cpp:12:34:   required from here
lambda.cpp:12:24: error: ‘ch’ is not captured
   12 |     [](auto) { odr_use(ch); }(123);
      |                        ^~
lambda.cpp:12:6: note: the lambda has no capture-default
   12 |     [](auto) { odr_use(ch); }(123);
      |      ^
lambda.cpp:6:20: note: ‘constexpr const char ch’ declared here
    6 |     constexpr char ch = '=';
      |

------

This is good enough for me so I'm closing this bug report.

Reply via email to