[Issue 7472] New: __traits compiles/ is(typeof) don't work for invalid type casts.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Feb 9 09:55:48 PST 2012


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

           Summary: __traits compiles/ is(typeof) don't work for invalid
                    type casts.
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: timon.gehr at gmx.ch


--- Comment #0 from timon.gehr at gmx.ch 2012-02-09 09:55:47 PST ---
DMD 2.057 and 2.058head

void main(){
    class X{} X    x;
    static assert(!__traits(compiles, cast(int)x));// assertion failure
    int y = cast(int)x;                            // compile error
}

Apparently casts are checked for validity too late.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list