tree.c (cp_tree_equal): Handle pointers to member functions.
1998-05-24 Mark Mitchell <mark@markmitchell.com> * tree.c (cp_tree_equal): Handle pointers to member functions. From-SVN: r20038
This commit is contained in:
parent
00c15f8deb
commit
7dd4bdf55d
|
@ -1,5 +1,7 @@
|
|||
1998-05-24 Mark Mitchell <mark@markmitchell.com>
|
||||
|
||||
* tree.c (cp_tree_equal): Handle pointers to member functions.
|
||||
|
||||
* call.c (maybe_handle_implicit_object): Handle QUAL_CONVs. Make
|
||||
sure the type of the REF_BIND is a reference type.
|
||||
(maybe_handle_ref_bind, compare_ics): Rename reference_type to
|
||||
|
|
|
@ -2134,7 +2134,23 @@ cp_tree_equal (t1, t2)
|
|||
TREE_STRING_LENGTH (t1));
|
||||
|
||||
case CONSTRUCTOR:
|
||||
abort ();
|
||||
/* We need to do this when determining whether or not two
|
||||
non-type pointer to member function template arguments
|
||||
are the same. */
|
||||
if (!(comptypes (TREE_TYPE (t1), TREE_TYPE (t2), 1)
|
||||
/* The first operand is RTL. */
|
||||
&& TREE_OPERAND (t1, 0) == TREE_OPERAND (t2, 0)))
|
||||
return 0;
|
||||
return cp_tree_equal (TREE_OPERAND (t1, 1), TREE_OPERAND (t2, 1));
|
||||
|
||||
case TREE_LIST:
|
||||
cmp = cp_tree_equal (TREE_PURPOSE (t1), TREE_PURPOSE (t2));
|
||||
if (cmp <= 0)
|
||||
return cmp;
|
||||
cmp = cp_tree_equal (TREE_VALUE (t1), TREE_VALUE (t2));
|
||||
if (cmp <= 0)
|
||||
return cmp;
|
||||
return cp_tree_equal (TREE_CHAIN (t1), TREE_CHAIN (t2));
|
||||
|
||||
case SAVE_EXPR:
|
||||
return cp_tree_equal (TREE_OPERAND (t1, 0), TREE_OPERAND (t2, 0));
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
// Build don't link:
|
||||
|
||||
template <class R, void (R::* A) (void)>
|
||||
class s
|
||||
{
|
||||
public:
|
||||
s (R &r) : _r (r) {}
|
||||
|
||||
void e (void) { (_r.*A) (); }
|
||||
|
||||
private:
|
||||
R &_r;
|
||||
};
|
||||
|
||||
class x
|
||||
{
|
||||
public:
|
||||
void test1 (void) { int j = 0; }
|
||||
void test2 (void) { int j = 1; }
|
||||
};
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
x r;
|
||||
|
||||
s<x, &x::test1> c4 (r);
|
||||
s<x, &x::test2> c5 (r);
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue