With trunk G++: $ ~/gcc/bin/g++ --version g++ (GCC) 4.6.0 20100901 (experimental) Copyright (C) 2010 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. $ cat fdc.cc extern void cf(); // no warning void *f() { return __extension__ (void *) cf; } // warning: // ISO C++ forbids casting between pointer-to-function and pointer-to-object template<bool flag> void *ft() { return __extension__ (void *) cf; } template void *ft<true>(); $ LD_LIBRARY_PATH=$HOME/gcc/lib ~/gcc/bin/g++ -Wall -pedantic -c fdc.cc fdc.cc: In function ‘void* ft() [with bool flag = true]’: fdc.cc:11:25: instantiated from here fdc.cc:9:44: warning: ISO C++ forbids casting between pointer-to-function and pointer-to-object [enabled by default] I would expect G++ to either complain about both casts, or neither; whether the code appears in a function template shouldn't matter.
Related to PR 21385.
It's the same issue. *** This bug has been marked as a duplicate of bug 21385 ***