diff mbox

C++ PATCH for c++/70141 (wrong partial specialization error)

Message ID 56E86056.5080807@redhat.com
State New
Headers show

Commit Message

Jason Merrill March 15, 2016, 7:19 p.m. UTC
The code in for_each_template_parm_r to walk into the RHS of 
TYPENAME_TYPE only when there isn't a predicate seemed nonsensical, and 
removing the condition didn't break anything in the testsuite.

Tested x86_64-pc-linux-gnu, applying to trunk.
diff mbox

Patch

commit 364983121fbd1a0c79185a5d0291bcef72970613
Author: Jason Merrill <jason@redhat.com>
Date:   Tue Mar 15 12:13:03 2016 -0400

    	PR c++/70141
    	* pt.c (for_each_template_parm_r): Always walk into TYPENAME_TYPE.

diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 9766668..724d6e9 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -8851,8 +8851,9 @@  for_each_template_parm_r (tree *tp, int *walk_subtrees, void *d)
       break;
 
     case TYPENAME_TYPE:
-      if (!fn)
-	WALK_SUBTREE (TYPENAME_TYPE_FULLNAME (t));
+      /* A template-id in a TYPENAME_TYPE might be a deduced context after
+	 partial instantiation.  */
+      WALK_SUBTREE (TYPENAME_TYPE_FULLNAME (t));
       break;
 
     case CONSTRUCTOR:
diff --git a/gcc/testsuite/g++.dg/template/partial-specialization4.C b/gcc/testsuite/g++.dg/template/partial-specialization4.C
new file mode 100644
index 0000000..1f2aced
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/partial-specialization4.C
@@ -0,0 +1,26 @@ 
+// PR c++/70141
+
+template <typename T>
+struct outer
+{
+  template <typename U>
+  struct inner
+  {
+
+  };
+};
+
+
+template <typename T>
+struct is_inner_for
+{
+  template <typename Whatever>
+  struct predicate;
+
+  template <typename U>
+  struct predicate<typename outer<T>::template inner<U> >
+  {
+  };
+};
+
+is_inner_for<int>::predicate<outer<int>::inner<double> > p;