[Issue 918] New: Template order matter, version block change something with typedef, and another template bug.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Feb 1 15:42:24 PST 2007


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

           Summary: Template order matter, version block change something
                    with typedef, and another template bug.
           Product: D
           Version: 1.004
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: baryluk at mpi.int.pl


import std.stdio;

typedef int num = 42;

version (A) {
        void pow(alias b)() {   writefln("full ", b); }
        void pow(num b)() {     writefln("num ", b); }
        void pow(int b)() {     writefln("int ", b); }
} else version (B) {
        void pow(num b)() {     writefln("num ", b); }
        void pow(alias b)() {   writefln("full ", b); }
        void pow(int b)() {     writefln("int ", b); }
} else version (C) {
        void pow(num b)() {     writefln("num ", b); }
        void pow(alias b)() {   writefln("full ", b); }
} else {
        static assert(false, "Provide version");
}

void main() {
        num wyk = 22;
        pow!(wyk);
}

/*
A: full 22

B: num 0  (why 0?, should be 22, eventually 42)

C:

./po.d(22): template instance pow!(wyk) matches more than one template
declaration, pow(num b) and pow(alias b)
./po.d(22): Error: import has no effect in expression (pow!(wyk))

Note: in A, B template "int" isn't used!

So probably 3 bugs.

When compiled without version block (leaving version B):

num 22

*/


-- 



More information about the Digitalmars-d-bugs mailing list