https://bugs.winehq.org/show_bug.cgi?id=47710
Bug ID: 47710 Summary: objidl.h contains invalid C++ Product: Wine Version: 4.15 Hardware: x86 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: winelib Assignee: wine-bugs@winehq.org Reporter: philip.rebohle@tu-dortmund.de Distribution: ---
Hello,
as of wine 4.15, building a winelib version of DXVK fails with the following error:
/usr/include/wine/windows/objidl.h:6100:15: error: ‘union _userSTGMEDIUM::<unnamed struct>::__WIDL_objidl_generated_name_0000000C’ invalid; an anonymous struct may only have public non-static data members [-fpermissive] 6100 | union __WIDL_objidl_generated_name_0000000C { | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The problem is that C++ does not allow declaring named unions or structs inside anonymous structs since it treats this as a nested type. Moreover, the anonymous struct that it is defined in seems unnecessary, although I might be missing some detail there.
Defining __WIDL_objidl_generated_name_0000000C as an empty string before including windows.h works around this problem.
https://bugs.winehq.org/show_bug.cgi?id=47710
Zebediah Figura z.figura12@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Component|winelib |rpc CC| |z.figura12@gmail.com Keywords| |regression Regression SHA1| |732f67ed38a45911d726df8da5a | |68710d175ba1d
--- Comment #1 from Zebediah Figura z.figura12@gmail.com --- Thanks for the report.
(In reply to Philip Rebohle from comment #0)
Moreover, the anonymous struct that it is defined in seems unnecessary, although I might be missing some detail there.
It's there largely because encapsulated unions can be defined on their own.
It seems MIDL generates a name for all anonymous UDTs. I'll send a patch.
https://bugs.winehq.org/show_bug.cgi?id=47710
--- Comment #2 from Zebediah Figura z.figura12@gmail.com --- (In reply to Zebediah Figura from comment #1)
It seems MIDL generates a name for all anonymous UDTs. I'll send a patch.
Nope, I was wrong. It does generate a name for top-level declarations, which we don't, but it doesn't generate a name for nested declarations. Instead the right thing to do seems to be to add the structure type _STGMEDIUM_UNION. Unfortunately Microsoft decided to violate the C spec (big surprise), so we need to define NONAMELESSUNION in every source file that includes objidl.idl before making this change.
https://bugs.winehq.org/show_bug.cgi?id=47710
Marcos Gutiérrez Batz sacrom@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |sacrom@gmail.com
https://bugs.winehq.org/show_bug.cgi?id=47710
Jeff Smith whydoubt@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |whydoubt@gmail.com
https://bugs.winehq.org/show_bug.cgi?id=47710
Zebediah Figura z.figura12@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED Fixed by SHA1| |6cfda676f7e0d1d2ab75a01aa66 | |c0269659218de Status|UNCONFIRMED |RESOLVED
--- Comment #3 from Zebediah Figura z.figura12@gmail.com --- This should be fixed by https://source.winehq.org/git/wine.git/commitdiff/6cfda676f7e0d1d2ab75a01aa66c0269659218de; thanks Jeff.
https://bugs.winehq.org/show_bug.cgi?id=47710
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #4 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 5.0-rc3.