re PR c++/48051 (sorry, unimplemented: mangling overload)
PR c++/48051 * mangle.c (write_expression): Mangle BASELINK scope if BASELINK_QUALIFIED_P. * search.c (adjust_result_of_qualified_name_lookup): Set BASELINK_QUALIFIED_P. * tree.c (cp_tree_equal) [BASELINK]: Compare BASELINK_QUALIFIED_P. * parser.c (cp_parser_postfix_dot_deref_expression): Don't call adjust_result_of_qualified_name_lookup for non-qualified names. From-SVN: r183133
This commit is contained in:
parent
ca5333f22c
commit
4643a68ec2
|
@ -1,5 +1,14 @@
|
|||
2012-01-12 Jason Merrill <jason@redhat.com>
|
||||
|
||||
PR c++/48051
|
||||
* mangle.c (write_expression): Mangle BASELINK scope if
|
||||
BASELINK_QUALIFIED_P.
|
||||
* search.c (adjust_result_of_qualified_name_lookup): Set
|
||||
BASELINK_QUALIFIED_P.
|
||||
* tree.c (cp_tree_equal) [BASELINK]: Compare BASELINK_QUALIFIED_P.
|
||||
* parser.c (cp_parser_postfix_dot_deref_expression): Don't call
|
||||
adjust_result_of_qualified_name_lookup for non-qualified names.
|
||||
|
||||
PR c++/51403
|
||||
* pt.c (unify): Handle error_mark_node.
|
||||
|
||||
|
|
|
@ -2500,7 +2500,9 @@ write_expression (tree expr)
|
|||
code = TREE_CODE (expr);
|
||||
}
|
||||
|
||||
if (code == BASELINK)
|
||||
if (code == BASELINK
|
||||
&& (!type_unknown_p (expr)
|
||||
|| !BASELINK_QUALIFIED_P (expr)))
|
||||
{
|
||||
expr = BASELINK_FUNCTIONS (expr);
|
||||
code = TREE_CODE (expr);
|
||||
|
@ -2583,10 +2585,20 @@ write_expression (tree expr)
|
|||
write_string ("at");
|
||||
write_type (TREE_OPERAND (expr, 0));
|
||||
}
|
||||
else if (TREE_CODE (expr) == SCOPE_REF)
|
||||
else if (code == SCOPE_REF
|
||||
|| code == BASELINK)
|
||||
{
|
||||
tree scope = TREE_OPERAND (expr, 0);
|
||||
tree member = TREE_OPERAND (expr, 1);
|
||||
tree scope, member;
|
||||
if (code == SCOPE_REF)
|
||||
{
|
||||
scope = TREE_OPERAND (expr, 0);
|
||||
member = TREE_OPERAND (expr, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
scope = BINFO_TYPE (BASELINK_ACCESS_BINFO (expr));
|
||||
member = BASELINK_FUNCTIONS (expr);
|
||||
}
|
||||
|
||||
if (!abi_version_at_least (2) && DECL_P (member))
|
||||
{
|
||||
|
|
|
@ -6045,9 +6045,9 @@ cp_parser_postfix_dot_deref_expression (cp_parser *parser,
|
|||
parser->qualifying_scope = NULL_TREE;
|
||||
parser->object_scope = NULL_TREE;
|
||||
}
|
||||
if (scope && name && BASELINK_P (name))
|
||||
if (parser->scope && name && BASELINK_P (name))
|
||||
adjust_result_of_qualified_name_lookup
|
||||
(name, BINFO_TYPE (BASELINK_ACCESS_BINFO (name)), scope);
|
||||
(name, parser->scope, scope);
|
||||
postfix_expression
|
||||
= finish_class_member_access_expr (postfix_expression, name,
|
||||
template_p,
|
||||
|
|
|
@ -1550,6 +1550,9 @@ adjust_result_of_qualified_name_lookup (tree decl,
|
|||
}
|
||||
}
|
||||
|
||||
if (BASELINK_P (decl))
|
||||
BASELINK_QUALIFIED_P (decl) = true;
|
||||
|
||||
return decl;
|
||||
}
|
||||
|
||||
|
|
|
@ -2320,6 +2320,7 @@ cp_tree_equal (tree t1, tree t2)
|
|||
case BASELINK:
|
||||
return (BASELINK_BINFO (t1) == BASELINK_BINFO (t2)
|
||||
&& BASELINK_ACCESS_BINFO (t1) == BASELINK_ACCESS_BINFO (t2)
|
||||
&& BASELINK_QUALIFIED_P (t1) == BASELINK_QUALIFIED_P (t2)
|
||||
&& cp_tree_equal (BASELINK_FUNCTIONS (t1),
|
||||
BASELINK_FUNCTIONS (t2)));
|
||||
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
2012-01-12 Jason Merrill <jason@redhat.com>
|
||||
|
||||
PR c++/48051
|
||||
* g++.dg/abi/mangle48.C: Test qualified-names, too.
|
||||
* g++.dg/abi/mangle58.C: Likewise.
|
||||
|
||||
PR c++/51403
|
||||
* g++.dg/template/arg8.C: New.
|
||||
|
||||
|
|
|
@ -13,6 +13,10 @@ struct A
|
|||
template <class U> auto f() -> decltype (b.f<U>());
|
||||
// { dg-final { scan-assembler "_ZN1A1gIiEEDTcldtptfpT1b1fIT_EEEv" } }
|
||||
template <class U> auto g() -> decltype (this->b.f<U>());
|
||||
// { dg-final { scan-assembler "_ZN1A1hIiEEDTcldtdtdefpT1bsr1B1fIT_EEEv" } }
|
||||
template <class U> auto h() -> decltype (b.B::f<U>());
|
||||
// { dg-final { scan-assembler "_ZN1A1iIiEEDTcldtptfpT1bsr1B1fIT_EEEv" } }
|
||||
template <class U> auto i() -> decltype (this->b.B::f<U>());
|
||||
};
|
||||
|
||||
int main()
|
||||
|
@ -20,4 +24,6 @@ int main()
|
|||
A a;
|
||||
a.f<int>();
|
||||
a.g<int>();
|
||||
a.h<int>();
|
||||
a.i<int>();
|
||||
}
|
||||
|
|
|
@ -6,14 +6,20 @@ struct B {
|
|||
static int cmp2(char a, char b);
|
||||
// { dg-final { scan-assembler "_ZN1B1fIcEEvR1AIT_X4cmp1EE" } }
|
||||
template <typename T> static void f (A<T,cmp1> &);
|
||||
// { dg-final { scan-assembler "_ZN1B1gIcEEvR1AIT_XsrS_4cmp1EE" } }
|
||||
template <typename T> static void g (A<T,B::cmp1> &);
|
||||
// { dg-final { scan-assembler "_ZN1B1fIcEEvR1AIT_L_ZNS_4cmp2EccEE" } }
|
||||
template <typename T> static void f (A<T,cmp2> &);
|
||||
// { dg-final { scan-assembler "_ZN1B1gIcEEvR1AIT_L_ZNS_4cmp2EccEE" } }
|
||||
template <typename T> static void g (A<T,B::cmp2> &);
|
||||
};
|
||||
|
||||
void g()
|
||||
{
|
||||
A<char,B::cmp1> a;
|
||||
B::f(a);
|
||||
B::g(a);
|
||||
A<char,B::cmp2> a2;
|
||||
B::f(a2);
|
||||
B::g(a2);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue