From 46b48ef565a731734522304b95b893ea07ac7ca0 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Tue, 21 Feb 2017 15:50:57 -0500 Subject: [PATCH] PR c++/41727 - ICE with partial spec of partial instantiation * pt.c (process_partial_specialization): For now, don't check more specialized if there is more than one level of args. From-SVN: r245642 --- gcc/cp/ChangeLog | 6 +++++ gcc/cp/pt.c | 3 +++ .../g++.dg/template/partial-specialization5.C | 22 +++++++++++++++++++ 3 files changed, 31 insertions(+) create mode 100644 gcc/testsuite/g++.dg/template/partial-specialization5.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 90272d2638e..13d7d33b8c3 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2017-02-21 Jason Merrill + + PR c++/41727 - ICE with partial spec of partial instantiation + * pt.c (process_partial_specialization): For now, don't check more + specialized if there is more than one level of args. + 2017-02-21 Marek Polacek PR c++/79535 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index c29e691b44c..38a01e168a7 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -4619,6 +4619,9 @@ process_partial_specialization (tree decl) /* If we aren't in a dependent class, we can actually try deduction. */ else if (tpd.level == 1 + /* FIXME we should be able to handle a partial specialization of a + partial instantiation, but currently we can't (c++/41727). */ + && TMPL_ARGS_DEPTH (specargs) == 1 && !get_partial_spec_bindings (maintmpl, maintmpl, specargs)) { if (permerror (input_location, "partial specialization %qD is not " diff --git a/gcc/testsuite/g++.dg/template/partial-specialization5.C b/gcc/testsuite/g++.dg/template/partial-specialization5.C new file mode 100644 index 00000000000..7a8db5a9661 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/partial-specialization5.C @@ -0,0 +1,22 @@ +// PR c++/41727 + +struct tag0; + +template < class Tag > struct outer +{ + template < typename Arg0, typename Arg1 > struct inner; +}; + +template < int Value > struct value_wrap { }; + +template +template < typename Arg0, int Arg1 > +struct outer ::inner < Arg0, value_wrap < Arg1 > > +{ + typedef Arg0 type; +}; + +typedef outer < tag0 > +::inner < tag0, value_wrap < 999 > > +::type // { dg-bogus "incomplete" "" { xfail *-*-* } } + outer_inner_type; -- 2.30.2