www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - different overloading of static and non-static functions in structs

<< << source >> >>
struct MyStruct{
    void test(short s){printf("dynamic short\n");}
    void test(int i){printf("dynamic int\n");}
    static void staticTest(short s){printf("static short\n");}
    static void staticTest(int i){printf("static int\n");}
}

void main(){
    MyStruct S;

    short s = 1;
    int i = 1;

    S.test(s);
    S.test(i);

    S.staticTest(s);
    S.staticTest(i); // !!!! calls staticTest( short )

}
 source << <<
Output:
 dynamic short
 dynamic int
 static short
 static short
Expected output:
 dynamic short
 dynamic int
 static short
 static int
Thomas
Aug 13 2004