2019-02-27 Marek Polacek PR c++/88857 - ICE with value-initialization of argument in template. * call.c (convert_like_real): Don't call build_value_init in template. --- gcc/cp/call.c +++ gcc/cp/call.c @@ -7005,7 +7005,8 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum, /* If we're initializing from {}, it's value-initialization. */ if (BRACE_ENCLOSED_INITIALIZER_P (expr) && CONSTRUCTOR_NELTS (expr) == 0 - && TYPE_HAS_DEFAULT_CONSTRUCTOR (totype)) + && TYPE_HAS_DEFAULT_CONSTRUCTOR (totype) + && !processing_template_decl) { bool direct = CONSTRUCTOR_IS_DIRECT_INIT (expr); if (abstract_virtuals_error_sfinae (NULL_TREE, totype, complain)) --- /dev/null +++ gcc/testsuite/g++.dg/cpp0x/initlist-value4.C @@ -0,0 +1,12 @@ +// PR c++/88857 +// { dg-do compile { target c++11 } } + +class S { int a; }; +void foo (const S &, int); + +template +void +bar () +{ + foo ({}); // { dg-error "too few arguments to function" } +}