[Issue 2126] New: class template specialization and inheritance

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat May 24 03:51:09 PDT 2008


http://d.puremagic.com/issues/show_bug.cgi?id=2126

           Summary: class template specialization and inheritance
           Product: D
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: www.digitalmars.com
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: michael.kiermaier at gmx.net


The following code

//begin code
import std.stdio;

class A(TT) { }

class B(TT) : A!(TT) { }

class C(T) {
    static void tellMe() {
        writefln("implementation for generic T.");
    }
}

class C(T:A!(TT),TT) {
    static void tellMe() {
        writefln("implememtation for T the same as or derived from A!(TT).");
    }
}

void main() {
    C!(A!(int)).tellMe();
    C!(B!(int)).tellMe();
    C!(int).tellMe();
}
//end code

compiled by DMD v2.008 produces the output

implememtation for T the same as or derived from A!(TT).
implementation for generic T.
implementation for generic T.


According to the documentation, the colon in 'C(T:A!(TT),TT)' means "the same
as or derived from". So the second line of the output should be "implememtation
for T the same as or derived from A!(TT)." in my opinion.


There was a discussion about this issue in digitalmars.D, see 
http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=71757

~Michael


-- 



More information about the Digitalmars-d-bugs mailing list