Very strange compilation error
    Nils Boßung via Digitalmars-d-learn 
    digitalmars-d-learn at puremagic.com
       
    Wed Oct 15 14:26:05 PDT 2014
    
    
  
On Wednesday 15 October 2014 21:29, Jack Applegame wrote:
> I don't understand why this code doesn't compile:
> 
> http://dpaste.dzfl.pl/dfd8df7f80ad
Immutability issues with unions ring a bell for me. This may be related to 
issue 12885 [1] which is the result of dmd pull #2665 [2] which even 
mentions std.date.SysTime.
Here's a reduced version of your test case:
---
struct Rebindable
{
    union
    {
        int m;
        immutable int i;
    }
    void opAssign(Rebindable another) {}
}
struct Foo3
{
    // Remove the union or _timezone and dmd accepts it.
    union
    {
        int m;
        immutable int i;
    }
    Rebindable _timezone;
}
void main()
{
    Foo3 foo3;
    foo3 = Foo3();
}
---
[1] https://issues.dlang.org/show_bug.cgi?id=12885
[2] https://github.com/D-Programming-Language/dmd/pull/2665
    
    
More information about the Digitalmars-d-learn
mailing list