From: Jason Merrill Date: Wed, 24 Apr 2019 20:37:30 +0000 (-0400) Subject: PR c++/90227 - error with template parameter packs. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=fd177738f3dc11a93cea8eaf816eee4461704911;p=gcc.git PR c++/90227 - error with template parameter packs. If require_all_args, we aren't waiting for more args to be deduced later. * pt.c (coerce_template_parms): Do add empty pack when require_all_args. From-SVN: r270556 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 3a6dc65dd5e..059a7fd0ea6 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2019-04-24 Jason Merrill + + PR c++/90227 - error with template parameter packs. + * pt.c (coerce_template_parms): Do add empty pack when + require_all_args. + 2019-04-24 Richard Biener * call.c (null_ptr_cst_p): Order checks according to expensiveness. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 5f73fac3e8f..e682b6d51be 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -8477,7 +8477,7 @@ coerce_template_parms (tree parms, arg = NULL_TREE; if (template_parameter_pack_p (TREE_VALUE (parm)) - && (arg || !(complain & tf_partial)) + && (arg || require_all_args || !(complain & tf_partial)) && !(arg && ARGUMENT_PACK_P (arg))) { /* Some arguments will be placed in the diff --git a/gcc/testsuite/g++.dg/cpp1y/var-templ62.C b/gcc/testsuite/g++.dg/cpp1y/var-templ62.C new file mode 100644 index 00000000000..f78ca858ce9 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/var-templ62.C @@ -0,0 +1,80 @@ +// PR c++/90227 +// { dg-do compile { target c++14 } } + +template struct c { static constexpr int d = b; typedef c e; }; +template using f = a; +template using h = c; +template using i = c; +template struct ab {}; +template struct k { using e = ab; }; +template struct ad; +template struct ad> { using e = ab; }; +template struct ae; +template struct ae> : i {}; +template ::d> struct ag; +template struct ag, 0, 0> { using e = ab<>; }; +template +struct ag, 0, ah> : k>::e, ah - 1>::e> {}; +template +struct ag, ai, ah> : ag>::e, ai - 1> {}; +template class> struct aj; +template class ak> struct aj, ak> { + using e = ab::e...>; +}; +template struct an; +struct ao { typedef an<0> ap; }; +template struct aq {}; +template struct as; +template struct as> { typedef aq ap; }; +template using au = typename as::ap; +template using av = aq; +template using aw = au; +struct ay { using e = h::d>; }; +template class, typename...> +struct bb : ay::e {}; +struct bd { using e = av<>; }; +struct bg { using e = bd::e; }; +namespace bi { +enum bj { bk }; +struct bo { enum n { bp }; }; +struct bq { bool br; static const bo::n bs = bo::bp; }; +template struct bw { using e = bv; }; +template class bx; +template +struct bx, av> : bo { + static const n bs = bv::bs; + static const long ca = sizeof bv::br; + using cb = int; + using cc = ab; + using cd = typename ag::e; + using ce = typename ag::e; + using cf = aw; + using cg = typename bw::e; + using ch = decltype(cg()(cb(), cd(), ce(), cf())); +}; +class ck; +template struct cl : c {}; +template +struct bx> : public bx, cl>::e, bg::e> {}; +} +using bi::bj; +using bi::ck; +template class co { + template co(p) { c(); } + static co o; +}; +namespace bi { +template class cp; +template using cq = bb; +template void cs(cr, f::d, void *> = nullptr); +} +using bi::cs; +struct cu : bi::bq { + template + auto operator()(int q, ab, ab, av<>) { + cs(q); + } +}; +template <> +co>> +co>>::o(0);