about summary refs log tree commit diff
path: root/absl/types
diff options
context:
space:
mode:
authorAbseil Team <absl-team@google.com>2019-06-10T08·57-0700
committerGennadiy Civil <misterg@google.com>2019-06-10T17·31-0400
commit361cb8a9db2f2130442389fd80593255be26d681 (patch)
treef38eca22b4fbf0933e06abf5d0546ec9c29721b4 /absl/types
parent0238ab0a831f179518c1a814f9584e99da2d75a3 (diff)
Export of internal Abseil changes.
--
4a21ad4ffa957d28b770de8717289fab7410f567 by Gennadiy Rozental <rogeeff@google.com>:

Internal cleanup

PiperOrigin-RevId: 252366381

--
b6b0f25439549c54f1537a16625be1fecd3c7d8c by Xiaoyi Zhang <zhangxy@google.com>:

Fix C4245 compiler warning of visual studio. This allows using abseil headers
in code requiring strict warning settings.
This is an import of https://github.com/abseil/abseil-cpp/pull/321.

PiperOrigin-RevId: 252101240

--
0543b7861b658a5a665298e1d868e29968ff7b27 by CJ Johnson <johnsoncj@google.com>:

Adds new benchmarks for the constructors of InlinedVector

PiperOrigin-RevId: 251905349

--
c65a08507917e9f8f6450b8beb235fe1426d7954 by CJ Johnson <johnsoncj@google.com>:

Updates the InlinedVector BatchedBenchmark abstractions to 1) provide the index of the instance back to the prepare and test functions so that callers may perform extra work on local state with a unique per-instance ID and 2) reduce the number of manually written calls to BENCHMARK_TEMPLATE.

PiperOrigin-RevId: 251895546

--
99a1ae2d786b80096172f6e018711e15c0c750b9 by Samuel Benzaquen <sbenza@google.com>:

Fix ambiguous construction problem in absl::variant<> to make in line with
std::variant.
ImaginaryFun is hiding duplicate objects instead of causing ambiguity. Add a
second unique argument to make sure all overloads exist in the final overload
set.

PiperOrigin-RevId: 251860694

--
b54d0a12673be6ebb6e77e24a556ce9b758b3a7e by Abseil Team <absl-team@google.com>:

Import of CCTZ from GitHub.

PiperOrigin-RevId: 251739183

--
f51b115e0dc3fc9a9c9c20b33a1f27027a700d48 by Abseil Team <absl-team@google.com>:

Import of CCTZ from GitHub.

PiperOrigin-RevId: 251686812

--
30e868049282dc6a6fc77d923ca7d2a5d35a1658 by Xiaoyi Zhang <zhangxy@google.com>:

Import of CCTZ from GitHub.

PiperOrigin-RevId: 251652119
GitOrigin-RevId: 4a21ad4ffa957d28b770de8717289fab7410f567
Change-Id: I7171cb613793fa90e0eb0143b65ec8264a2a84db
Diffstat (limited to 'absl/types')
-rw-r--r--absl/types/internal/variant.h12
-rw-r--r--absl/types/variant_test.cc5
2 files changed, 12 insertions, 5 deletions
diff --git a/absl/types/internal/variant.h b/absl/types/internal/variant.h
index 5ca66e2902c6..85201b4ae1f9 100644
--- a/absl/types/internal/variant.h
+++ b/absl/types/internal/variant.h
@@ -837,8 +837,8 @@ struct ImaginaryFun<variant<H, T...>, I> : ImaginaryFun<variant<T...>, I + 1> {
   // NOTE: const& and && are used instead of by-value due to lack of guaranteed
   // move elision of C++17. This may have other minor differences, but tests
   // pass.
-  static SizeT<I> Run(const H&);
-  static SizeT<I> Run(H&&);
+  static SizeT<I> Run(const H&, SizeT<I>);
+  static SizeT<I> Run(H&&, SizeT<I>);
 };
 
 // The following metafunctions are used in constructor and assignment
@@ -860,7 +860,8 @@ struct ConversionIsPossibleImpl : std::false_type {};
 
 template <class Variant, class T>
 struct ConversionIsPossibleImpl<
-    Variant, T, void_t<decltype(ImaginaryFun<Variant>::Run(std::declval<T>()))>>
+    Variant, T,
+    void_t<decltype(ImaginaryFun<Variant>::Run(std::declval<T>(), {}))>>
     : std::true_type {};
 
 template <class Variant, class T>
@@ -868,8 +869,9 @@ struct ConversionIsPossible : ConversionIsPossibleImpl<Variant, T>::type {};
 
 template <class Variant, class T>
 struct IndexOfConstructedType<
-    Variant, T, void_t<decltype(ImaginaryFun<Variant>::Run(std::declval<T>()))>>
-    : decltype(ImaginaryFun<Variant>::Run(std::declval<T>())) {};
+    Variant, T,
+    void_t<decltype(ImaginaryFun<Variant>::Run(std::declval<T>(), {}))>>
+    : decltype(ImaginaryFun<Variant>::Run(std::declval<T>(), {})) {};
 
 template <std::size_t... Is>
 struct ContainsVariantNPos
diff --git a/absl/types/variant_test.cc b/absl/types/variant_test.cc
index b9c981181c50..d702482768a4 100644
--- a/absl/types/variant_test.cc
+++ b/absl/types/variant_test.cc
@@ -460,6 +460,11 @@ TYPED_TEST(VariantTypesTest, TestValueCtor) {
   EXPECT_EQ(value.value, mutable_valptr->value);
 }
 
+TEST(VariantTest, AmbiguousValueConstructor) {
+  EXPECT_FALSE((std::is_convertible<int, absl::variant<int, int>>::value));
+  EXPECT_FALSE((std::is_constructible<absl::variant<int, int>, int>::value));
+}
+
 TEST(VariantTest, InPlaceType) {
   using Var = variant<int, std::string, NonCopyable, std::vector<int>>;