https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88857
--- Comment #6 from Marek Polacek <mpolacek at gcc dot gnu.org> --- (In reply to Jakub Jelinek from comment #5) > Indeed: > class S { int a; }; > void foo (const S &, int); > > template <int N> > void > bar () > { > foo ({}); > } > > With s/class/struct/ it doesn't ICE. build_value_init has an assertion that > 346 /* The AGGR_INIT_EXPR tweaking below breaks in templates. */ > 347 gcc_assert (!processing_template_decl > 348 || (SCALAR_TYPE_P (type) || TREE_CODE (type) == > ARRAY_TYPE)); > So, shall convert_like_real just not call it at all if > processing_template_decl? Likely, or only for scalar types. This is the same problem I hit recently with tweaking the narrowing detection. I could poke at this later, unless you want it.