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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Nov 29 18:31:44 PST 2010


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



--- Comment #2 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2010-11-29 18:30:13 PST ---
(In reply to comment #1)
> 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 at 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: -------


More information about the Digitalmars-d-bugs mailing list