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


Don <clugd...@yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |clugd...@yahoo.com.au


--- Comment #15 from Don <clugd...@yahoo.com.au> 2012-09-24 06:31:57 PDT ---
(In reply to comment #13)
> (In reply to comment #12)
> > For structs, as long as there is no static opCall declared, S() and S.init
> > should be identical, 
> 
> This is not already true for nested structs.
> 
> void main() {
>     int g = 10;
>     struct S {
>         int n;
>         auto foo(){ return g; }
>     }
>     auto s1 = S();  // StructLiteralExp
>     assert(s1.tupleof[$-1] !is null);  // hidden ptr is filled
>     assert(s1.foo() == 10);            // OK
>     auto s2 = S.init;
>     assert(s2.tupleof[$-1]  is null);  // hidden ptr isn't filled
>     assert(s2.foo() == 10);            // Access Violation!
> }

That's a bug: .init for nested structs is garbage. It's the cause of bug 6419,
for example. defaultInitLiteral() is wrong.

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

Reply via email to