The following code compiles in Visual C ++ and gcc, but does not work with Code Warrior
The complaint is that the template call is ambiguous - no decision can be made between doIt (M *) and doIt (M const *), although in each case the parameter is definitely or not const. Annoyingly, if I put the second argument to the template, it decides that it is no longer ambiguous.
template< typename T1, typename T2 > T1 const* doIt( T2 const* ); template< typename T1, typename T2 > T1* doIt( T2* ); class M {}; class N : public M {}; void f() { M* m1 = NULL; M const* m2 = NULL; doIt<N>( m1 );
Is this just a bug with the Code Warrior compiler? (Or a bug with gcc / Visual C ++).
source share