www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 5291] New: ref parameter and const/immutable == hole in const system

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

           Summary: ref parameter and const/immutable == hole in const
                    system
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: accepts-invalid
          Severity: critical
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: simen.kjaras gmail.com



PST ---
Can't believe nobody has noticed this before:

void bar( ref int n ) {
    n++;
}

void main( string[] args ) {
    const int n = args.length * 0;
    assert( is( typeof( n ) == const(int) ) );
    bar( n ); // Uhm...
    assert( n == 1 ); // WTF?!?
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 29 2010
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5291


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrovich gmail.com



18:29:09 PST ---
immutable bug example:

bug.d:
void bar( ref int n )
{
       n++;
}

void main( string[] args )
{
       immutable int n = args.length * 0;
       assert( is( typeof( n ) == const(int) ) );
       bar( n ); // Uhm...
       assert( n == 1 );
}

compiled with "dmd bug.d"
core.exception.AssertError bug(11): Assertion failure

compiled with "dmd bug.d -release -O -inline"
object.Error: assert(0) or HLT instruction

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 29 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5291




18:30:13 PST ---

 immutable bug example:
 
 bug.d:
 void bar( ref int n )
 {
        n++;
 }
 
 void main( string[] args )
 {
        immutable int n = args.length * 0;
        assert( is( typeof( n ) == const(int) ) );
        bar( n ); // Uhm...
        assert( n == 1 );
 }
 
 compiled with "dmd bug.d"
 core.exception.AssertError bug(11): Assertion failure
 
 compiled with "dmd bug.d -release -O -inline"
 object.Error: assert(0) or HLT instruction
My bad I forgot about the first assert. Sorry! -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 29 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5291


nfxjfg gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nfxjfg gmail.com



This is actually well known. See bug 2095 or bug 4251.
I can't believe it hasn't been fixed yet.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 30 2010
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5291


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

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