digitalmars.D.learn - I guess this is a bug?
- Random D user (40/40) Sep 12 2015 or is it some obscure feature conflict?
- Random D user (4/6) Sep 12 2015 Oh... and I'm using win 64-bit and dmd 2.068.1, but this behavior
- anonymous (2/5) Sep 12 2015 Looks like a bug to me. Please file an issue at https://issues.dlang.org...
or is it some obscure feature conflict?
struct Foo
{
     this( float x_, float y_ )
     {
         // option A
         //x = x_;
         //y = y_;
         // option B
         v[0] = x_;
         v[1] = y_;
     }
     union
     {
         struct
         {
             float x = 0;
             float y = 0;
         }
         float[2] v;
     }
}
struct Bar
{
     Foo foo = Foo( 1, 2 );
}
Bar bar;
Bar baz = bar.init;
printf( "bar: %f, %f\n", bar.foo.x, bar.foo.y );
printf( "baz: %f, %f\n", baz.foo.x, baz.foo.y );
-------------------------------------------------
prints (with option B):
bar: 0.000000, 0.000000   // BUG??
baz: 1.000000, 2.000000
prints (with option A):
bar: 1.000000, 2.000000
baz: 1.000000, 2.000000
-------------------------------------------------
Luckily the option A works as I expected and is good enough for 
me...
 Sep 12 2015
On Saturday, 12 September 2015 at 18:28:02 UTC, Random D user wrote:or is it some obscure feature conflict? [...]Oh... and I'm using win 64-bit and dmd 2.068.1, but this behavior was present earlier than that...
 Sep 12 2015
On Saturday 12 September 2015 20:28, Random D user wrote:prints (with option B): bar: 0.000000, 0.000000 // BUG?? baz: 1.000000, 2.000000Looks like a bug to me. Please file an issue at https://issues.dlang.org/
 Sep 12 2015








 
  
  
 
 "Random D user" <no email.com>
 "Random D user" <no email.com> 