Commit 19096841 authored by Harris Hancock's avatar Harris Hancock

Work around spurious MSVC noexcept dtor compile error

parent 4e178217
......@@ -794,6 +794,15 @@ class Maybe;
namespace _ { // private
#if _MSC_VER
// TODO(msvc): MSVC barfs on noexcept(instance<T&>().~T()) where T = kj::Exception and
// kj::_::Void. It and every other factorization I've tried produces:
// error C2325: 'kj::Blah' unexpected type to the right of '.~': expected 'void'
#define MSVC_NOEXCEPT_DTOR_WORKAROUND(T) __is_nothrow_destructible(T)
#else
#define MSVC_NOEXCEPT_DTOR_WORKAROUND(T) noexcept(instance<T&>().~T())
#endif
template <typename T>
class NullableValue {
// Class whose interface behaves much like T*, but actually contains an instance of T and a
......@@ -818,7 +827,7 @@ public:
ctor(value, other.value);
}
}
inline ~NullableValue() noexcept(noexcept(instance<T&>().~T())) {
inline ~NullableValue() noexcept(MSVC_NOEXCEPT_DTOR_WORKAROUND(T)) {
if (isSet) {
dtor(value);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment