Template specialization

Daniel Kozak kozzi11 at gmail.com
Thu Jan 23 04:44:48 PST 2014


import std.stdio;

class D : X{}

class X{}


template t1(T : void function(T)){enum t1 = "1.";}
template t1(T : void function(X)){enum t1 = "2.";}

int main(string[] argv){
     t1!(void function(D)).writeln();
     readln();
     return 0;
}

this code prints 1. on dmd and gdc but on ldc it prints 2.

Which one is correct?


More information about the Digitalmars-d mailing list