mapbox / variant

C++11/C++14 Variant
BSD 3-Clause "New" or "Revised" License
371 stars 101 forks source link

disable noexcept on destructor for MSVC #87

Closed lightmare closed 8 years ago

lightmare commented 8 years ago

Refs https://github.com/mapbox/variant/issues/86

joto commented 8 years ago

Not pretty, but if it is necessary, it is necessary.

lightmare commented 8 years ago

No, the second commit was (edit: overwritten by forced push) a bad idea, sorry.

It will break a class that inherits a noexcept(true) virtual destructor and adds a member variant with recursive_wrapper.

lightmare commented 8 years ago

Ok, finally got it to compile on gcc4.7 as well as AppVeyor.

@BergWerkGIS can you please test mapnik with this? a1df843 (I did a few force pushes so you'll probably need to git reset --hard if you previously checked out this branch.

springmeyer commented 8 years ago

Going to merge this to unblock Mapnik windows builds (refs https://github.com/mapbox/windows-builds/issues/76).

lightmare commented 8 years ago

Although AppVeyor build succeeded here, it still fails in mapnik: error C2541: 'delete': cannot delete objects that are not pointers (obviously MSVC doesn't like my noexcept(delete std::declval<T*>())

Previously when I used std::is_nothrow_destructible<T>, it said about x.~T() dtor call syntax not being allowed outside function call (which I interpreted as not being allowed in exception specification, and std::is_nothrow_destructible probably uses that...)

springmeyer commented 8 years ago

@lightmare also seeing that. Hrmm. Can you see a way to add a test to mapbox/variant to cover this (so we don't have to depend on mapnik to catch the problem)?

lightmare commented 8 years ago

@springmeyer I would like to, but I'm running out of ideas. The previous errors/crashes were due to dubious/conflicting noexcept specifiers. But this is really weird, my detail::is_nothrow_destructible is wrapped in #elif defined(_MSC_VER), both mapnik and variant tests should see that definition so I don't understand why only one complains.