Is this a bug in struct literals ?

HATA hata at mail1.big.or.jp
Fri Jun 8 04:12:56 PDT 2007


Hello.

I found that a question of following program in D-Language sled in huge BBS named 2ch in Japan.
We think this is bug. In dmd 1.015ver. this bug has not yet fixed.
If you has known these bugs, sorry.

import std.stdio;
struct A{int v;} 
void main(){ 
    A a = A(10); 
    if (a == a.init) writefln(a.v,"(a==a.init)"); 
    else writefln(a.v,"(a!=a.init)"); 
    a.v = 100; 
    if (a == a.init) writefln(a.v,"(a==a.init)"); 
    else writefln(a.v,"(a!=a.init)"); 
    a = A(1000); 
    if (a == a.init) writefln(a.v,"(a==a.init)"); 
    else writefln(a.v,"(a!=a.init)"); 
} 

Result of execution:
all comparisons in "if" are true.
and all values of a.v are 10.


More information about the Digitalmars-d-bugs mailing list