http://d.puremagic.com/issues/show_bug.cgi?id=9904



--- Comment #3 from Andrej Mitrovic <[email protected]> 2013-04-08 
10:31:56 PDT ---
(In reply to comment #2)
> (In reply to comment #1)
> 
> > Those should really use size_t to reproduce on all systems:
> > 
> > > struct S1
> > > {
> > >     size_t x;
> > > }
> > > 
> > > struct S2
> > > {
> > >     size_t x;
> > >     byte b;
> > > }
> 
> Why is that cast a problem/bug? Maybe there is no compiler bug here.

It may not do what the user expects. For example they might think this is a
good way to initialize the struct to its default value, but it's wrong:

import std.math;

struct S
{
    float x;
}

void main()
{
    auto s1 = S.init;
    auto s2 = cast(S)null;
    assert(isnan(s1.x));
    assert(isnan(s2.x));  // fails
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to