2 // g++ 1.36.1 bug 900215_02
4 // g++ allows global objects (which happen to be pointers to members of some
5 // class X) to be dereferenced without prefix object specifications within
6 // member functions of class X.
8 // In effect, g++ treats any dereference of a pointer-to-member which appears
9 // within the context of a member function (and which is not preceeded by
10 // either ->* or .*) as if it had been implicitly prefixed with this->*.
12 // The 2.0 Reference Manual only provides that such implicit prefixing
13 // takes place for *members* of the containing class, and *not* for
14 // global objects that happen to have certain types (i.e. pointer-to-member
15 // of the containing class).
17 // Also, cfront 2.0 provides implicit this-> prefixes *only* for *members*
18 // of the containing class.
20 // Cfront 2.0 passes this test.
22 // keywords: member pointers, this, dereference, members
26 void function_member ();
30 int (struct0::*fmp) ();
36 void function_member ();
39 void struct0::function_member ()
41 i = (this->*fmp) (); // perfectly legal - for both cfront and g++
42 i = this->*dmp; // perfectly legal - for both cfront and g++
44 i = (*fmp) (); // { dg-error "" }
45 i = *dmp; // { dg-error "" }
48 int main () { return 0; }