Remove old autovect-branch by moving to "dead" directory.
[official-gcc.git] / old-autovect-branch / gcc / testsuite / g++.old-deja / g++.bugs / 900215_02.C
blob6802299b6b0417fd3297ed7e65a512d6c23db9a6
1 // { dg-do assemble  }
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
24 struct struct0 {
25   int data_member;
26   void function_member ();
29 int struct0::*dmp;
30 int (struct0::*fmp) ();
31 int i;
33 struct struct1 {
34   int data_member;
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; }