aboutsummaryrefslogtreecommitdiffhomepage
path: root/absl/types/internal/variant.h
diff options
context:
space:
mode:
Diffstat (limited to 'absl/types/internal/variant.h')
-rw-r--r--absl/types/internal/variant.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/absl/types/internal/variant.h b/absl/types/internal/variant.h
index f220afd..eff4fef 100644
--- a/absl/types/internal/variant.h
+++ b/absl/types/internal/variant.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Abseil Authors.
+// Copyright 2018 The Abseil Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -910,6 +910,11 @@ struct PerformVisitation {
template <std::size_t... TupIs, std::size_t... Is>
constexpr ReturnType Run(std::false_type /*has_valueless*/,
index_sequence<TupIs...>, SizeT<Is>...) const {
+ static_assert(
+ std::is_same<ReturnType,
+ absl::result_of_t<Op(VariantAccessResult<
+ Is, QualifiedVariants>...)>>::value,
+ "All visitation overloads must have the same return type.");
return absl::base_internal::Invoke(
absl::forward<Op>(op),
VariantCoreAccess::Access<Is>(