https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116476
--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-14 branch has been updated by Marek Polacek <mpola...@gcc.gnu.org>: https://gcc.gnu.org/g:0784e8934e96187e17c1b02dce1e0ed35d2229dd commit r14-10799-g0784e8934e96187e17c1b02dce1e0ed35d2229dd Author: Marek Polacek <pola...@redhat.com> Date: Wed Aug 28 15:45:49 2024 -0400 c++: wrong error due to std::initializer_list opt [PR116476] Here maybe_init_list_as_array gets elttype=field, init={NON_LVALUE_EXPR <2>} and it tries to convert the init's element type (int) to field using implicit_conversion, which works, so overall maybe_init_list_as_array is successful. But it constifies init_elttype so we end up with "const int". Later, when we actually perform the conversion and invoke field::field(T&&), we end up with this error: error: binding reference of type 'int&&' to 'const int' discards qualifiers So I think maybe_init_list_as_array should try to perform the conversion, like it does below with fc. PR c++/116476 gcc/cp/ChangeLog: * call.cc (maybe_init_list_as_array): Try convert_like and see if it worked. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/initlist-opt2.C: New test. Reviewed-by: Jason Merrill <ja...@redhat.com> (cherry picked from commit 9f79c7ddff5f1b004803931406ad17eaba095fff)