[clang] [Clang] [Sema] Error on reference types inside a union with msvc 1910+ (PR #102851)
Max Winkler via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 12 19:41:22 PDT 2024
MaxEW707 wrote:
> > I definitely remember this being an extension in older versions of VS around VS 2012 but don't know when MSVC no longer exactly removed support for this extension wholesale.
>
> This was definitely required for MFC headers; I remember implementing this horrible nonsense ages ago, see #14109 -- I can verify that `CComControlBase` no longer has the terrible union in it, but I'm not certain when it lost it.
I went through the atlmfc headers shipped with MSVC 1914, 1929 and 1940 and didn't find any uses of references inside a union.
I finally managed to find this documented after some MSDN spelunking.
https://learn.microsoft.com/en-us/cpp/porting/visual-cpp-what-s-new-2003-through-2015?view=msvc-170
Look for the section titled, "Union data members".
It says, "Data members of unions can no longer have reference types. The following code compiled successfully in Visual Studio 2013, but produces an error in Visual Studio 2015.". I think it is safe to say starting with VS2015 this is no longer supported and thus any headers shipped will not be using references inside unions.
https://github.com/llvm/llvm-project/pull/102851
More information about the cfe-commits
mailing list