https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102482
--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to Jonathan Wakely from comment #6) > The warning should not trigger if the constructor takes the initializer_list > by non-const lvalue reference. I think this change to cp/init.c:maybe_warn_list_ctor will check if the initializer_list parameter is a non-const lvalue reference: --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -750,7 +750,8 @@ maybe_warn_list_ctor (tree member, tree init) return; tree parms = FUNCTION_FIRST_USER_PARMTYPE (current_function_decl); - tree initlist = non_reference (TREE_VALUE (parms)); + tree parm1 = TREE_VALUE (parms); + tree initlist = non_reference (parm1); tree targs = CLASSTYPE_TI_ARGS (initlist); tree elttype = TREE_VEC_ELT (targs, 0); @@ -758,6 +759,10 @@ maybe_warn_list_ctor (tree member, tree init) (TREE_TYPE (memtype), elttype)) return; + if (TYPE_REF_P (parm1) && !TYPE_REF_IS_RVALUE (parm1) + && !(cp_type_quals (initlist) & TYPE_QUAL_CONST)) + return; + tree begin = find_list_begin (init); if (!begin) return;