Blame SOURCES/gcc8-pr86747.patch

f56e54
2018-12-06  Alexandre Oliva <aoliva@redhat.com>
f56e54
 
f56e54
	PR c++/86747
f56e54
	* pt.c (tsubst_friend_class): Enter tsubsted class context.
f56e54
f56e54
--- gcc/cp/pt.c
f56e54
+++ gcc/cp/pt.c
f56e54
@@ -10558,7 +10558,10 @@ tsubst_friend_class (tree friend_tmpl, tree args)
f56e54
   if (TREE_CODE (context) == NAMESPACE_DECL)
f56e54
     push_nested_namespace (context);
f56e54
   else
f56e54
-    push_nested_class (context);
f56e54
+    {
f56e54
+      context = tsubst (context, args, tf_error, NULL_TREE);
f56e54
+      push_nested_class (context);
f56e54
+    }
f56e54
 
f56e54
   tmpl = lookup_name_real (DECL_NAME (friend_tmpl), /*prefer_type=*/false,
f56e54
 			   /*non_class=*/false, /*block_p=*/false,
f56e54
--- /dev/null
f56e54
+++ gcc/testsuite/g++.dg/pr86747.C
f56e54
@@ -0,0 +1,8 @@
f56e54
+// { dg-do compile }
f56e54
+
f56e54
+template <typename T> class A {
f56e54
+  template <void (A::*p)()> class C; // #1
f56e54
+  template <void (A::*q)()> friend class C; // #2
f56e54
+};
f56e54
+
f56e54
+A<double> a;