c++/8171: pointers to member functions comparison

Jozef Kosoru zyzstar@ibl.sk
Tue Oct 8 11:06:00 GMT 2002


>Number:         8171
>Category:       c++
>Synopsis:       pointers to member functions comparison
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Tue Oct 08 11:06:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Jozef Kosoru <zyzstar@ibl.sk>
>Release:        3.1.1
>Organization:
>Environment:
Mandrake Linux
>Description:
g++ is not able to compile the following code:

----------------------------------------------------
#include <iostream>
using namespace std;

struct A
{
    int f() {}
};

struct B : A
{
};

int main()
{
    int (A::*pa)() = &A::f;
    int (B::*pb)() = &B::f;

    cout << boolalpha << (pa == pb) << endl;
}
----------------------------------------------------

...but according to ISO (see 5.10/2) this code should compile and result of the pointer comparsion would be 'true'.
>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the Gcc-prs mailing list