Invariants broken with out cast!!!

Denton Cockburn diboss at hotmail.com
Fri Dec 7 00:13:38 PST 2007


On Thu, 06 Dec 2007 20:43:12 -0800, Robert DaSilva wrote:

> An invariant(int) can be assigned to an invariant(int)*, this wasn't
> possible in 2.007. Just compile the attach test case. import std.stdio;
> 
> void main()
> {
>     invariant(int) a;
>     invariant(int)* b = &a; // error in 2.007, ok in 2.008 writeln(*b);
>     a = 1;
> //    *b = 2; // error
>     writeln(*b);
> }

Even if it's broken, the behaviour seems logical to me.
The types aren't different, so why would you need a cast?

Just my 2 cents.



More information about the Digitalmars-d mailing list