https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116731
--- Comment #7 from Marek Polacek <mpolacek at gcc dot gnu.org> --- For 13, we need this: --- a/gcc/cp/parser.cc +++ b/gcc/cp/parser.cc @@ -13851,11 +13851,12 @@ warn_for_range_copy (tree decl, tree expr) else if (!CP_TYPE_CONST_P (type)) return; - /* Since small trivially copyable types are cheap to copy, we suppress the - warning for them. 64B is a common size of a cache line. */ + /* Since small trivially constructible types are cheap to construct, we + suppress the warning for them. 64B is a common size of a cache line. */ + tree list = build_tree_list (NULL_TREE, TREE_TYPE (expr)); if (TREE_CODE (TYPE_SIZE_UNIT (type)) != INTEGER_CST || (tree_to_uhwi (TYPE_SIZE_UNIT (type)) <= 64 - && trivially_copyable_p (type))) + && is_trivially_xible (INIT_EXPR, type, list))) return; /* If we can initialize a reference directly, suggest that to avoid the