re PR c++/48157 (Unable to match function call to member function template)
authorJason Merrill <jason@redhat.com>
Wed, 6 Jul 2011 04:20:39 +0000 (00:20 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Wed, 6 Jul 2011 04:20:39 +0000 (00:20 -0400)
PR c++/48157
* pt.c (tsubst_qualified_id): Preserve TEMPLATE_ID_EXPR in
partial instantiation.

From-SVN: r175904

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/template/template-id-4.C [new file with mode: 0644]

index a1104b4..ed94e06 100644 (file)
@@ -1,5 +1,9 @@
 2011-07-05  Jason Merrill  <jason@redhat.com>
 
+       PR c++/48157
+       * pt.c (tsubst_qualified_id): Preserve TEMPLATE_ID_EXPR in
+       partial instantiation.
+
        PR c++/49598
        * semantics.c (finish_id_expression): convert_from_reference.
 
index e7be08b..17ca44c 100644 (file)
@@ -11287,8 +11287,12 @@ tsubst_qualified_id (tree qualified_id, tree args,
     expr = name;
 
   if (dependent_scope_p (scope))
-    return build_qualified_name (NULL_TREE, scope, expr,
-                                QUALIFIED_NAME_IS_TEMPLATE (qualified_id));
+    {
+      if (is_template)
+       expr = build_min_nt (TEMPLATE_ID_EXPR, expr, template_args);
+      return build_qualified_name (NULL_TREE, scope, expr,
+                                  QUALIFIED_NAME_IS_TEMPLATE (qualified_id));
+    }
 
   if (!BASELINK_P (name) && !DECL_P (expr))
     {
index ccf0730..072bf15 100644 (file)
@@ -1,3 +1,8 @@
+2011-07-05  Jason Merrill  <jason@redhat.com>
+
+       PR c++/48157
+       * g++.dg/template/template-id-4.C: New.
+
 2011-07-05  Georg-Johann Lay  <avr@gjlay.de>
 
        * gcc.dg/pr44023.c: Add dg-require-effective-target int32plus
diff --git a/gcc/testsuite/g++.dg/template/template-id-4.C b/gcc/testsuite/g++.dg/template/template-id-4.C
new file mode 100644 (file)
index 0000000..26f4809
--- /dev/null
@@ -0,0 +1,22 @@
+// PR c++/48157
+
+struct AType
+{
+  template<class AA>
+  void SomeFuncTemplate()
+  { }
+};
+
+template < class T >
+struct TTest2
+{
+  template<T> struct helper;
+
+  template<class U>
+  static void check(helper<&U::template SomeFuncTemplate<int> > *);
+};
+
+int main()
+{
+  TTest2< void (AType::*)() >::check<AType>(0);
+}