[Issue 9244] union containing pointers not allowed

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Jan 14 03:49:49 PST 2013


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


yebblies <yebblies at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid
                 CC|                            |yebblies at gmail.com
           Platform|x86                         |All
         OS/Version|Windows                     |All
           Severity|normal                      |regression


--- Comment #2 from yebblies <yebblies at gmail.com> 2013-01-14 22:49:46 EST ---
Reduced:

void main()
{
    union U {
        int i;
        @safe int x() { return i; }
    }
}

Because U has a function in it, dmd incorrectly decides it is a nested union
and (even worse) inserts a void* member.

A regression because:
- @safe code didn't always disallow unions with pointers
- wrapping x in an attribute such as @safe used to make the compiler infer U as
non-nested

Workaround: make U static

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


More information about the Digitalmars-d-bugs mailing list