Dear all, I would like to post a bug report for the GNU C/C++ compiler 3.3-e500. We use the compiler to generate code for a PowerPC processor. Used invokation line for the GNU C++ compiler: ccppc -c -x c++ -ansi -Wall -Werror -mcpu=8540 -fverbose-asm -mbig -fmerge-templates -mmultiple -mno-string -mstrict-align -O3 -fno-exceptions -fno-rtti -fno-builtin-printf -I<different include paths> -D<differen #define's> X.CPP -oX.O // file X.CPP void f (int); typedef int* I; I f0 () { return static_cast<I>(f); } <--- line 5 I f1 () { return reinterpret_cast<I>(f); } <--- line 7 I f2 () { return (I)f; } // cast notation I f3 () { return I(f); } // functional notation The compiler gives the following error messages: X.CPP: In function `int* f0()': X.CPP:5: error: invalid static_cast from type `void ()(int)' to type `int*' X.CPP: In function `int* f1()': X.CPP:7: error: ISO C++ forbids casting between pointer-to-function and pointer-to-object I think the compiler should also reject the casts in f2() and f3(): - 5.4/5 states that the cast notation of explicit conversion performs only the conversions of a const_cast<>, of a static_cast<>, of reinterpret_cast<> and of certain combinations of those casts. - 5.2.3/1 says that cast in f3() is equivalent to the cast in f2(). Kind regards W. Roehrl
This is a dup of bug 10818. Note DR 195 is related to this case. *** This bug has been marked as a duplicate of 10818 ***