[Issue 4628] New: Casting away const should be allowed in safe mode if no indirection

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Aug 11 19:36:46 PDT 2010


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

           Summary: Casting away const should be allowed in safe mode if
                    no indirection
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: dsimcha at yahoo.com


--- Comment #0 from David Simcha <dsimcha at yahoo.com> 2010-08-11 19:36:45 PDT ---
void fun() @safe {
    const uint foo = 2;
    uint bar = foo;  // Works.
    auto bar = cast(uint) foo;  // Doesn't work;
}


test9.d(4): Error: cast from const(uint) to uint not allowed in safe code
test9.d(4): Error: declaration test9.fun.bar is already defined

-- 
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