DMD 1.025 and 2.009 releases
torhu
no at spam.invalid
Sat Jan 12 12:26:58 PST 2008
eao197 wrote:
I've modified 3 lines in your main function:
> void
> main()
> {
> void show( Message m )
void show( in Message m )
> {
> writefln( &m.notifier, ": ", m.notifier.i );
writefln( cast(Notifier*)&m.notifier, ": ", m.notifier.i );
> }
>
> auto m1 = new Message( new Notifier( 1 ) );
> show( m1 );
>
> auto m2 = new invariant(Message)( new Notifier( 2 ) );
auto m2 = cast(invariant) new Message( new Notifier( 2 ) );
> show( m2 );
> m2.notifier = new Notifier( 3 );
> show( m2 );
> }
>
With these changes, I get the error "Error: cannot modify
const/invariant m2.notifier".
More information about the Digitalmars-d-announce
mailing list