[Issue 11132] Odd diagnostic with C-style struct initializer when union field is present

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Sep 27 15:39:09 PDT 2013


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



--- Comment #1 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2013-09-27 15:39:07 PDT ---
In case you're wondering, I've ran into it while porting this code:

-----
struct STGMEDIUM
{
    DWORD tymed;
    union
    {
        HBITMAP hBitmap;
        PVOID hMetaFilePict;
        HENHMETAFILE hEnhMetaFile;
        HGLOBAL hGlobal;
        LPWSTR lpszFileName;
        LPSTREAM pstm;
        LPSTORAGE pstg;
    }

    LPUNKNOWN pUnkForRelease;
}

STGMEDIUM stgmed = { TYMED.TYMED_HGLOBAL, { 0 }, 0 };
-----

Speaking of which, what is a union field initialized to in D? I mean, what does
.init equal to for multiple types? Is it just the bit-pattern zero?

-- 
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