www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 556] New: is (Type Identifier : TypeSpecialization) doesn't work as it should

reply d-bugmail puremagic.com writes:
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 digitalmars.com
        ReportedBy: deewiant 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.


-- 
Nov 18 2006
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=556





------- Comment #1 from bugzilla digitalmars.com  2007-10-04 03:58 -------
The documentation is in error, I'll fix it.


-- 
Oct 04 2007
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=556


braddr puremagic.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




------- Comment #2 from braddr puremagic.com  2007-10-20 04:03 -------
Docs updated in 1.022/2.005


-- 
Oct 20 2007