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 #5 from kuzniar95 at o2 dot pl ---
Actually everything is done well, my bad, sorry.

This code explains what's going on:

-------------------

void not_odr_use(char);
void odr_use(char&);

int main()
{
    constexpr char ch1 = '=';

    [] { not_odr_use(ch1); }; // compiles
    [] { odr_use(ch1); }; // doesn't compile and it shouldn't



    constexpr char ch2 = '=';
    [](auto) { not_odr_use(ch2); }; // this line doesn't instantiate the
template (generic lambda is like a hidden template function) so "ch2" never
gets to be used
}

-------------------

I'm happy to close this and confirm that it isn't a compiler bug.

Reply via email to