1 // Build don't link: 2 // 3 // Copyright (C) 2000 Free Software Foundation, Inc. 4 // Contributed by Nathan Sidwell 14 Aug 2000 <nathan@codesourcery.com> 5 6 // A pointer to member can only be formed by `&T::m', however, other forms 7 // are ok for pointer to static member. Thus the error can only be determined 8 // after overload resolution. 9 10 struct A 11 { 12 static int ns (short); 13 static int ns (float); 14 int ns (int); 15 int ns (double); 16 int single (int); 17 static int sole (short); 18 void foo (); 19 }; foo()20void A::foo () 21 { 22 int (A::*ptr1) (int) = &A::ns; 23 int (A::*ptr2) (int) = A::ns; // ERROR - not ptr mem 24 int (A::*ptr3) (int) = &ns; // ERROR - not ptr mem 25 int (A::*ptr4) (int) = ns; // ERROR - not ptr mem 26 27 int (*ptr5) (short) = &A::ns; 28 int (*ptr6) (short) = A::ns; 29 int (*ptr7) (short) = &ns; 30 int (*ptr8) (short) = ns; 31 32 int (A::*ptr11) (int) = &A::single; 33 int (A::*ptr12) (int) = A::single; // ERROR - not ptr mem 34 int (A::*ptr13) (int) = &single; // ERROR - not ptr mem 35 int (A::*ptr14) (int) = single; // ERROR - not ptr mem 36 37 int (A::*ptr20) (int) = &(A::ns); // ERROR - not ptr mem 38 int (A::*ptr21) (int) = &(A::single); // ERROR - not ptr mem 39 40 int (*ptr31) (short) = &A::sole; 41 int (*ptr32) (short) = A::sole; 42 int (*ptr33) (short) = &sole; 43 int (*ptr34) (short) = sole; 44 int (*ptr41) (short) = &(A::sole); 45 int (*ptr43) (short) = &(sole); 46 } 47