Commit 008d5fcc by Paolo Carlini Committed by Paolo Carlini

re PR c++/38174 (Missing some built-in candidates for operator overloading)

/cp
2011-10-14  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/38174
	* call.c (add_builtin_candidate): If two pointers have a composite
	pointer type, generate a single candidate with that type.

/testsuite
2011-10-14  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/38174
	* g++.dg/overload/operator4.C: New.

From-SVN: r179984
parent e11a4c80
2011-10-14 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/38174
* call.c (add_builtin_candidate): If two pointers have a composite
pointer type, generate a single candidate with that type.
2011-10-13 Jason Merrill <jason@redhat.com>
PR c++/50614
......
......@@ -2582,6 +2582,21 @@ add_builtin_candidate (struct z_candidate **candidates, enum tree_code code,
|| MAYBE_CLASS_TYPE_P (type1)
|| TREE_CODE (type1) == ENUMERAL_TYPE))
{
if (TYPE_PTR_P (type1) || TYPE_PTR_TO_MEMBER_P (type1))
{
tree cptype = composite_pointer_type (type1, type2,
error_mark_node,
error_mark_node,
CPO_CONVERSION,
tf_none);
if (cptype != error_mark_node)
{
build_builtin_candidate
(candidates, fnname, cptype, cptype, args, argtypes, flags);
return;
}
}
build_builtin_candidate
(candidates, fnname, type1, type1, args, argtypes, flags);
build_builtin_candidate
......
2011-10-14 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/38174
* g++.dg/overload/operator4.C: New.
2011-10-14 David Alan Gilbert <david.gilbert@linaro.org>
* gcc.dg/di-longlong64-sync-1.c: New test.
......
// PR c++/38174
struct VolatileIntPtr {
operator int volatile *();
};
struct ConstIntPtr {
operator int const *();
};
void test_with_ptrs(VolatileIntPtr vip, ConstIntPtr cip) {
bool b1 = (vip == cip);
long p1 = vip - cip;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment