[Issue 15575] partial initialization of a union member causes wrong diagnostic during CTFE
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Thu Oct  5 13:23:17 UTC 2023
    
    
  
https://issues.dlang.org/show_bug.cgi?id=15575
Basile-z <b2.temp at gmx.com> changed:
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|ice                         |CTFE, rejects-valid
                 CC|                            |b2.temp at gmx.com
            Summary|Wrong value for static      |partial initialization of a
                   |immutable struct with union |union member causes wrong
                   |                            |diagnostic during CTFE
--- Comment #3 from Basile-z <b2.temp at gmx.com> ---
updated test case:
```
struct B15575 {
    union {
        ubyte[2] a;
        struct {
            ubyte b;
            ubyte c;
        }
    }
    this(ubyte b) {
        if (b)
            this.a[0] = b;
        else
            this.b = b;
        this.c = 0;
    }
}
void main()
{
    auto a = B15575(7).a;     // run-time OK
    pragma(msg, B15575(7).a); // CTFE NG
}     
```
--
    
    
More information about the Digitalmars-d-bugs
mailing list