Logical const
Simen kjaeraas
simen.kjaras at gmail.com
Mon Nov 29 18:30:43 PST 2010
Andrej Mitrovic <andrej.mitrovich at gmail.com> wrote:
> Oh this one is even more spectacular:
>
> 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 );
> }
>
> K:\code>dmd bug.d -release -O -inline
> K:\code>bug
> object.Error: assert(0) or HLT instruction
>
> I'll update the bugzilla entry.
Don't. It's your first assert, failing as
const(int) != immutable(int)
--
Simen
More information about the Digitalmars-d
mailing list