digitalmars.D - Overloading function with a generic function fails
- Abid H. Mujtaba (12/12) May 12 2011 This is another example from "The D Programming Language" by Andrei Alex...
- Andrej Mitrovic (1/1) May 12 2011 Known issue, it's in bugzilla somewhere.
- Andrei Alexandrescu (4/5) May 12 2011 Yah, partial ordering is not fully implemented across template and
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.
May 12 2011
Known issue, it's in bugzilla somewhere.
May 12 2011
On 5/12/11 12:27 PM, Andrej Mitrovic wrote:Known issue, it's in bugzilla somewhere.Yah, partial ordering is not fully implemented across template and non-template functions. Thanks Abid for the report. Andrei
May 12 2011








Andrei Alexandrescu <SeeWebsiteForEmail erdani.org>