mpark / variant

C++17 `std::variant` for C++11/14/17
https://mpark.github.io/variant
Boost Software License 1.0
659 stars 88 forks source link

"C'tor/d'tor is not implicitly called" error with Unreal Engine (VS 2017) #46

Closed patrikhuber closed 5 years ago

patrikhuber commented 6 years ago

Hi,

Unfortunately mpark::variant doesn't compile in Unreal Engine projects. It gives the following errors:

Severity    Code    Description Project File    Line    Suppression State
Error   C4583   'mpark::detail::recursive_union<mpark::detail::Trait::Available,0,eos::morphablemodel::PcaModel,eos::morphablemodel::Blendshapes>::head_': destructor is not implicitly called  MyTestProject   variant.hpp 1353    
Error   C4583   'mpark::detail::recursive_union<mpark::detail::Trait::Available,0,eos::morphablemodel::PcaModel,eos::morphablemodel::Blendshapes>::tail_': destructor is not implicitly called  MyTestProject   variant.hpp 1353    

The line in question is:

    MPARK_VARIANT_RECURSIVE_UNION(Trait::Available,
                                  ~recursive_union() {});

Outside of Unreal Engine projects, it of course works flawlessly. Unfortunately, Unreal Engine has its own build system (UBT), and it's very peculiar on how it uses Visual Studio. It's basically a VS 2017 project and uses the VS 2017 compiler, but in C++14 mode, with the compiler flags set by some Unreal Engine C# build scripts (yes, it's horrible...).

Now I would be interested in: Why does this occur (apparently) only when building mpark::variant in Unreal Engine, which uses the VS 2017 compiler, so it should presumably work? What makes it fail? Could it be some peculiar compiler flag? Or is it a potential bug in mpark::variant? And is there a chance you could fix it? :-)

Thank you very much!

mpark commented 6 years ago

Haha, while Googling around for this issue, I found https://github.com/akrzemi1/Optional/issues/57 along with the 2 links that Andrzej referred to. It seems like you're planning to figure out what to do from UE side of things? Seems like there's not much I can do from my end, aside from say, ignoring those warnings myself.