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

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Reduced:

void* const NONE = nullptr; //Compiles

void beforeParam();

template<typename U>
void create(U && u) noexcept {
    const void* const& r = ( (void) beforeParam(), u );
}

void test_func() {
    create(NONE);
}


comma.cc: In instantiation of ‘void create(U&&) [with U = void* const&]’:
comma.cc:11:11:   required from here
comma.cc:7:24: error: lvalue required as unary ‘&’ operand
    7 |     const void* const& r = ( (void) beforeParam(), u );
      |                        ^


GCC has recurring problems with parentheses causing lvalue expressions to be
incorrectly treated as rvalues.

Reply via email to