[Issue 5291] New: ref parameter and const/immutable == hole in const system

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Nov 29 18:08:47 PST 2010


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 at puremagic.com
        ReportedBy: simen.kjaras at gmail.com


--- Comment #0 from Simen Kjaeraas <simen.kjaras at gmail.com> 2010-11-29 18:07:18 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: -------


More information about the Digitalmars-d-bugs mailing list