[Issue 556] New: is (Type Identifier : TypeSpecialization) doesn't work as it should

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Nov 18 05:06:33 PST 2006


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

           Summary: is (Type Identifier : TypeSpecialization) doesn't work
                    as it should
           Product: D
           Version: 0.174
          Platform: PC
               URL: http://www.digitalmars.com/d/expression.html#IsExpressio
                    n
        OS/Version: Windows
            Status: NEW
          Keywords: spec
          Severity: normal
          Priority: P4
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: deewiant at gmail.com
OtherBugsDependingO 511
             nThis:


A code snippet somewhat modified from what's in the spec:

alias short bar;
void foo(bar x) {
    static if (is (bar T : int))
        alias T S;
    else
        alias real S;

    static assert (is (S == int));
}

void main() {
        bar x;
        foo(x);
}

This fails, though according to the spec it should work. What's strange is that
replacing the first two lines of foo() with the following works:

static if (is (bar : int))
        alias int S;

Disclaimer: I haven't used this (is (Type Identifier)) feature at all, so I'm
not 100% sure. But if this isn't meant to work then the example code in the
spec is wrong.


-- 




More information about the Digitalmars-d-bugs mailing list