This is another example from "The D Programming Language" by Andrei
Alexandrescu. Compiling the following:
// Code in test.d:
void transmogrify( uint x ) {}
void transmogrify( long x ) {}
void transmogirfy(T)( T x ) {}
unittest {
transmogrify( 42 ) ;
}
fails with the following error (when compiled with 'rdmd --main -unittest
test.d' :
test.d(3): Error: template test.transmogrify(T) conflicts with function
test.transmogrify at test.d(1)
As I understood it the D compiler is capable of setting up a partial ordering
of functions and choosing one of the three overloaded functions based upon how
it was called.
Note: The example above works if I remove the generic function that is
overloading works for explicit types but not for generic types.