diff mbox

C++ PATCH for c++/41727, ICE with partial specialization of member of instantiation

Message ID CADzB+2nEaQ4CDvxQ1dYXK7tZFa30fyeeAY8MztHeD7aQ1KHPCA@mail.gmail.com
State New
Headers show

Commit Message

Jason Merrill Feb. 21, 2017, 8:50 p.m. UTC
This was a regression from rejects-valid to ice-on-valid.  This patch
fixes the ICE, but not the underlying bug.

Tested x86_64-pc-linux-gnu, applying to trunk.
commit 6788ad9769bfce33d478c426aafbebccdbb5f795
Author: Jason Merrill <jason@redhat.com>
Date:   Tue Feb 21 08:21:55 2017 -0800

            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.
diff mbox

Patch

diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 2cac24f..475ac1f 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 0000000..7a8db5a
--- /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 </* class Tag */>
+template < typename Arg0, int Arg1 >
+struct outer <tag0 >::inner < Arg0, value_wrap < Arg1 > >
+{
+  typedef Arg0 type;
+};
+
+typedef outer < tag0 >
+::inner < tag0, value_wrap < 999 > >
+::type				// { dg-bogus "incomplete" "" { xfail *-*-* } }
+  outer_inner_type;