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 a1104b44de9fff363a19cfbda304fae12c2af5e2..ed94e066f44f1b4fdb89c2f669a6550e33a5c6fd 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 e7be08bf0598c557494a753e4c54c6f54eff8bdd..17ca44cde0d0e32d826f222678feda6a25198d2c 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 ccf0730769bd6ee1b4ab03d4a168f568331cdc58..072bf15cd10fa61f9c2da0d65b84a80fd3d13c13 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);
+}