X-Git-Url: https://oss.titaniummirror.com/gitweb?a=blobdiff_plain;f=gcc%2Ftestsuite%2Fg%2B%2B.old-deja%2Fg%2B%2B.brendan%2Foperators4.C;fp=gcc%2Ftestsuite%2Fg%2B%2B.old-deja%2Fg%2B%2B.brendan%2Foperators4.C;h=0000000000000000000000000000000000000000;hb=6fed43773c9b0ce596dca5686f37ac3fc0fa11c0;hp=2fee7e6720e01cd2ba7832c3e7e3bf957578e506;hpb=27b11d56b743098deb193d510b337ba22dc52e5c;p=msp430-gcc.git diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/operators4.C b/gcc/testsuite/g++.old-deja/g++.brendan/operators4.C deleted file mode 100644 index 2fee7e67..00000000 --- a/gcc/testsuite/g++.old-deja/g++.brendan/operators4.C +++ /dev/null @@ -1,121 +0,0 @@ -// GROUPS passed operators -// Check that the & operator, when applied to a global function -// or member function returns a proper value as long as the context -// in which the result of & is used requires a pointer to a specific -// unambigous (function-pointer) type. -// -// This test fails (in test5()) when compiled with g++ 1.34.1. - -extern "C" int printf (const char *, ...); - -int function (char c); -int function (float f); - -class base { - int filler; -public: - int method (char); - int method (float); -}; - -void* vp; - -typedef int (*ptr_to_func_of_char)(char); -typedef int (*ptr_to_func_of_float)(float); -typedef int (base::*ptr_to_method_of_char)(char); -typedef int (base::*ptr_to_method_of_float)(float); - -int test2 (void*); -int test3 (void*); -int test4 (void*); -int test5 (void*); - -base* base_ptr; - -int fail () -{ - printf ("FAIL\n"); - return 1; -} - -int main () -{ - base_ptr = new base; - - ptr_to_func_of_char p0 = &function; - vp = (void*) p0; - if (test2 (vp)) - return fail (); - ptr_to_func_of_float p1 = &function; - vp = (void*) p1; - if (test3 (vp)) - return fail (); - ptr_to_method_of_char p2 = &base::method; - vp = (void*) p2; // ERROR - - if (test4 (vp)) - return fail (); - ptr_to_method_of_float p3 = &base::method; - vp = (void*) p3; // ERROR - - if (test5 (vp)) - return fail (); - - printf ("PASS\n"); - return 0; -} - -int test2 (void* vp) -{ - char ch = 'x'; - - return (((ptr_to_func_of_char)vp)(ch) != 9901); -} - -int test3 (void* vp) -{ - float flt = 9.9; - - return (((ptr_to_func_of_float)vp)(flt) != 9902); -} - -int test4 (void* vp) -{ - char ch = 'x'; - ptr_to_method_of_char p = (ptr_to_method_of_char) vp; // ERROR - bad type conversion - - return ((base_ptr->*p)(ch) != 9904); -} - -int test5 (void* vp) -{ - float flt = 9.9; - ptr_to_method_of_float p = (ptr_to_method_of_float) vp; // ERROR - bad type conversion - - if ((base_ptr->*p)(flt) != 9905) { - return 1; - } else - return 0; -} - -int function (char c) -{ - c = c; - return 9901; -} - -int function (float f) -{ - f = f; - return 9902; -} - -int base::method (char c) -{ - c = c; - return 9904; -} - -int base::method (float f) -{ - f = f; - return 9905; -}