Mercurial > projects > dstress
view run/i/inline_11_A.d @ 1539:eb6a99028b95
[Issue 1262] Local variable of struct type initialized by literal resets when compared to .init
Frits van Bommel <fvbommel@wxs.nl>
2007-06-12
http://d.puremagic.com/issues/show_bug.cgi?id=1262
author | thomask |
---|---|
date | Sun, 01 Jul 2007 13:17:11 +0000 |
parents | b8c0195059d9 |
children |
line wrap: on
line source
// $HeadURL$ // $Date$ // $Author$ // @author@ Victor Nakoryakov <nail-mail@mail.ru> // @date@ 2005-06-25 // @uri@ http://www.digitalmars.com/pnews/read.php?server=news.digitalmars.com&group=digitalmars.D.bugs&artnum=4396 module dstress.run.i.inline_11_A; struct Struct{ int i; Struct foo(){ Struct s; int a = i; int b = s.i; with (s) { i+=2; } assert(a==i); assert(b+2==s.i); return s; } Struct bar(){ return Struct.foo() * Struct.foo(); } Struct opMul(Struct s){ Struct ss; ss.i = s.i * i; return ss; } } int main(){ Struct s; assert(s.bar().i==4); return 0; }