From 31d2ea2a9ad99d3d3c238c204fe29a4ad7c357e6 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Wed, 6 Jul 2011 00:20:39 -0400 Subject: [PATCH] re PR c++/48157 (Unable to match function call to member function template) PR c++/48157 * pt.c (tsubst_qualified_id): Preserve TEMPLATE_ID_EXPR in partial instantiation. From-SVN: r175904 --- gcc/cp/ChangeLog | 4 ++++ gcc/cp/pt.c | 8 +++++-- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/template/template-id-4.C | 22 +++++++++++++++++++ 4 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/g++.dg/template/template-id-4.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index a1104b44de9..ed94e066f44 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2011-07-05 Jason Merrill + 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. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index e7be08bf059..17ca44cde0d 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -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)) { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ccf0730769b..072bf15cd10 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-07-05 Jason Merrill + + PR c++/48157 + * g++.dg/template/template-id-4.C: New. + 2011-07-05 Georg-Johann Lay * 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 index 00000000000..26f4809bc96 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/template-id-4.C @@ -0,0 +1,22 @@ +// PR c++/48157 + +struct AType +{ + template + void SomeFuncTemplate() + { } +}; + +template < class T > +struct TTest2 +{ + template struct helper; + + template + static void check(helper<&U::template SomeFuncTemplate > *); +}; + +int main() +{ + TTest2< void (AType::*)() >::check(0); +} -- 2.30.2