summaryrefslogtreecommitdiff
path: root/absl/types/variant.h
diff options
context:
space:
mode:
Diffstat (limited to 'absl/types/variant.h')
-rw-r--r--absl/types/variant.h15
1 files changed, 10 insertions, 5 deletions
diff --git a/absl/types/variant.h b/absl/types/variant.h
index 9d98a9ed..17e0634d 100644
--- a/absl/types/variant.h
+++ b/absl/types/variant.h
@@ -449,14 +449,19 @@ constexpr bool operator!=(monostate, monostate) noexcept { return false; }
//------------------------------------------------------------------------------
template <typename T0, typename... Tn>
class variant<T0, Tn...> : private variant_internal::VariantBase<T0, Tn...> {
+ static_assert(absl::conjunction<std::is_object<T0>,
+ std::is_object<Tn>...>::value,
+ "Attempted to instantiate a variant containing a non-object "
+ "type.");
// Intentionally not qualifing `negation` with `absl::` to work around a bug
// in MSVC 2015 with inline namespace and variadic template.
- static_assert(absl::conjunction<std::is_object<T0>, std::is_object<Tn>...,
- negation<std::is_array<T0> >,
- negation<std::is_array<Tn> >...,
- std::is_nothrow_destructible<T0>,
+ static_assert(absl::conjunction<negation<std::is_array<T0> >,
+ negation<std::is_array<Tn> >...>::value,
+ "Attempted to instantiate a variant containing an array type.");
+ static_assert(absl::conjunction<std::is_nothrow_destructible<T0>,
std::is_nothrow_destructible<Tn>...>::value,
- "Attempted to instantiate a variant with an unsupported type.");
+ "Attempted to instantiate a variant containing a non-nothrow "
+ "destructible type.");
friend struct variant_internal::VariantCoreAccess;