diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 74122c1c86e..f126a104d58 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2009-11-09 Jason Merrill + + PR c++/41994 + * pt.c (tsubst_baselink): tsubst the name. + 2009-11-07 Jason Merrill PR c++/37920 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 6e708b3edfa..3efeda80fe6 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -10318,7 +10318,7 @@ tsubst_baselink (tree baselink, tree object_type, qualifying_scope = tsubst (qualifying_scope, args, complain, in_decl); fns = BASELINK_FUNCTIONS (baselink); - optype = BASELINK_OPTYPE (baselink); + optype = tsubst (BASELINK_OPTYPE (baselink), args, complain, in_decl); if (TREE_CODE (fns) == TEMPLATE_ID_EXPR) { template_id_p = true; @@ -10329,6 +10329,8 @@ tsubst_baselink (tree baselink, tree object_type, complain, in_decl); } name = DECL_NAME (get_first_fn (fns)); + if (IDENTIFIER_TYPENAME_P (name)) + name = mangle_conv_op_name_for_type (optype); baselink = lookup_fnfields (qualifying_scope, name, /*protect=*/1); /* If lookup found a single function, mark it as used at this @@ -10347,8 +10349,7 @@ tsubst_baselink (tree baselink, tree object_type, BASELINK_FUNCTIONS (baselink), template_args); /* Update the conversion operator type. */ - BASELINK_OPTYPE (baselink) - = tsubst (optype, args, complain, in_decl); + BASELINK_OPTYPE (baselink) = optype; if (!object_type) object_type = current_class_type; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 740b64d327b..a470e60eb28 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2009-11-09 Jason Merrill + + PR c++/41994 + * g++.dg/template/conv10.C: New. + 2009-11-07 Jason Merrill PR c++/37920 diff --git a/gcc/testsuite/g++.dg/template/conv10.C b/gcc/testsuite/g++.dg/template/conv10.C new file mode 100644 index 00000000000..0a001be14e1 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/conv10.C @@ -0,0 +1,9 @@ +// PR c++/41994 + +template struct A +{ + operator T(); + A() { T (A::*f)() = &A::operator T; } +}; + +A a;