diff options
Diffstat (limited to 'absl')
-rw-r--r-- | absl/base/call_once.h | 2 | ||||
-rw-r--r-- | absl/base/casts.h | 1 | ||||
-rw-r--r-- | absl/base/internal/low_level_alloc.h | 1 | ||||
-rw-r--r-- | absl/base/internal/spinlock.h | 1 | ||||
-rw-r--r-- | absl/base/macros.h | 1 | ||||
-rw-r--r-- | absl/strings/internal/str_format/arg.h | 3 | ||||
-rw-r--r-- | absl/strings/internal/str_format/convert_test.cc | 11 |
7 files changed, 19 insertions, 1 deletions
diff --git a/absl/base/call_once.h b/absl/base/call_once.h index 8c4f297c..e7fc2300 100644 --- a/absl/base/call_once.h +++ b/absl/base/call_once.h @@ -29,6 +29,7 @@ #include <atomic> #include <cstdint> #include <type_traits> +#include <utility> #include "absl/base/internal/invoke.h" #include "absl/base/internal/low_level_scheduling.h" @@ -36,6 +37,7 @@ #include "absl/base/internal/scheduling_mode.h" #include "absl/base/internal/spinlock_wait.h" #include "absl/base/macros.h" +#include "absl/base/optimization.h" #include "absl/base/port.h" namespace absl { diff --git a/absl/base/casts.h b/absl/base/casts.h index a381c427..aba01782 100644 --- a/absl/base/casts.h +++ b/absl/base/casts.h @@ -27,6 +27,7 @@ #include <cstring> #include <memory> #include <type_traits> +#include <utility> #include "absl/base/internal/identity.h" #include "absl/base/macros.h" diff --git a/absl/base/internal/low_level_alloc.h b/absl/base/internal/low_level_alloc.h index b35673de..c98cdb30 100644 --- a/absl/base/internal/low_level_alloc.h +++ b/absl/base/internal/low_level_alloc.h @@ -25,6 +25,7 @@ // IWYU pragma: private, include "base/low_level_alloc.h" #include <sys/types.h> + #include <cstdint> #include "absl/base/attributes.h" diff --git a/absl/base/internal/spinlock.h b/absl/base/internal/spinlock.h index 940f56af..a55aa20b 100644 --- a/absl/base/internal/spinlock.h +++ b/absl/base/internal/spinlock.h @@ -32,6 +32,7 @@ #include <stdint.h> #include <sys/types.h> + #include <atomic> #include "absl/base/attributes.h" diff --git a/absl/base/macros.h b/absl/base/macros.h index ca620792..606a90ac 100644 --- a/absl/base/macros.h +++ b/absl/base/macros.h @@ -31,6 +31,7 @@ #include <cassert> #include <cstddef> +#include "absl/base/optimization.h" #include "absl/base/port.h" // ABSL_ARRAYSIZE() diff --git a/absl/strings/internal/str_format/arg.h b/absl/strings/internal/str_format/arg.h index 4d48af06..5cb3a14d 100644 --- a/absl/strings/internal/str_format/arg.h +++ b/absl/strings/internal/str_format/arg.h @@ -7,6 +7,7 @@ #include <cstdio> #include <iomanip> #include <limits> +#include <memory> #include <sstream> #include <string> #include <type_traits> @@ -292,7 +293,7 @@ class FormatArgImpl { struct Manager<T, ByPointer> { static Data SetValue(const T& value) { Data data; - data.ptr = &value; + data.ptr = std::addressof(value); return data; } diff --git a/absl/strings/internal/str_format/convert_test.cc b/absl/strings/internal/str_format/convert_test.cc index 3b4d4b0c..814ccf4c 100644 --- a/absl/strings/internal/str_format/convert_test.cc +++ b/absl/strings/internal/str_format/convert_test.cc @@ -367,6 +367,17 @@ typedef ::testing::Types< INSTANTIATE_TYPED_TEST_CASE_P(TypedFormatConvertTestWithAllIntTypes, TypedFormatConvertTest, AllIntTypes); +TEST_F(FormatConvertTest, VectorBool) { + // Make sure vector<bool>'s values behave as bools. + std::vector<bool> v = {true, false}; + const std::vector<bool> cv = {true, false}; + EXPECT_EQ("1,0,1,0", + FormatPack(UntypedFormatSpecImpl("%d,%d,%d,%d"), + absl::Span<const FormatArgImpl>( + {FormatArgImpl(v[0]), FormatArgImpl(v[1]), + FormatArgImpl(cv[0]), FormatArgImpl(cv[1])}))); +} + TEST_F(FormatConvertTest, Uint128) { absl::uint128 v = static_cast<absl::uint128>(0x1234567890abcdef) * 1979; absl::uint128 max = absl::Uint128Max(); |