www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4689] New: Error: cast from const(int) to real not allowed in safe code

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4689

           Summary: Error: cast from const(int) to real not allowed in
                    safe code
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: zan77137 nifty.com



This code should be compiled:

struct S{
    int x;
     safe const real getX(){ return cast(real)x; }
}

Error: cast from const(int) to real not allowed in safe code

See also: http://lists.puremagic.com/pipermail/phobos/2010-August/001958.html
(2010/08/20 0:08), Andrei Alexandrescu wrote:
 Line 414: no need for  trusted, casting numbers is not unsafe.
Error: cast from const(long) to real not allowed in safe code
Compiler bug. I wonder whether const has anything to do with (shouldn't).
-- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 20 2010
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4689


yebblies <yebblies gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |yebblies gmail.com
         Resolution|                            |DUPLICATE



*** This issue has been marked as a duplicate of issue 5088 ***

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