From: Jason Merrill Date: Thu, 22 Dec 2016 20:29:07 +0000 (-0500) Subject: PR c++/78906 - ICE with member variable template X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=bcf77f8ae6b9616537d539de911124a1db219aac;p=gcc.git PR c++/78906 - ICE with member variable template * pt.c (finish_template_variable): Use most_general_template. From-SVN: r243897 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 6f193c4e2db..2969762844f 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 2016-12-22 Jason Merrill + PR c++/78906 + * pt.c (finish_template_variable): Use most_general_template. + PR c++/78898 PR c++/42329 * pt.c (unify): Don't look for a class template from a non-class. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 7711546f7b7..3fa2ce9df67 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -9000,6 +9000,7 @@ finish_template_variable (tree var, tsubst_flags_t complain) tree tmpl_args = DECL_TI_ARGS (DECL_TEMPLATE_RESULT (templ)); arglist = add_outermost_template_args (tmpl_args, arglist); + templ = most_general_template (templ); tree parms = DECL_TEMPLATE_PARMS (templ); arglist = coerce_innermost_template_parms (parms, arglist, templ, complain, /*req_all*/true, diff --git a/gcc/testsuite/g++.dg/cpp1y/var-templ54.C b/gcc/testsuite/g++.dg/cpp1y/var-templ54.C new file mode 100644 index 00000000000..f52f7641913 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/var-templ54.C @@ -0,0 +1,13 @@ +// PR c++/78906 +// { dg-do compile { target c++14 } } + +template struct A { static constexpr int digits = 0; }; +template struct B { + template ::digits> + static constexpr int XBitMask = 0; +}; +struct C { + using ReferenceHost = B; + template static decltype(ReferenceHost::XBitMask<0>) XBitMask; +}; +int main() { C::XBitMask<0>; }