summaryrefslogtreecommitdiff
path: root/absl/meta
diff options
context:
space:
mode:
authorGravatar Abseil Team <absl-team@google.com>2019-08-15 10:06:39 -0700
committerGravatar vslashg <gfalcon@google.com>2019-08-15 14:36:45 -0400
commitaae8143cf9aa611f70d7ea9b95b8b8b383b2271a (patch)
tree131d9bf69d90050cc21bdb5c35bca797c58dd5c6 /absl/meta
parentd9aa92d7fb324314f9df487ac23d32a25650b742 (diff)
Export of internal Abseil changes
-- f28b989d5161230c6561e923b458c797a96bcf90 by Greg Falcon <gfalcon@google.com>: Import of CCTZ from GitHub. PiperOrigin-RevId: 263586488 -- 8259484025b7de45358719fc6182a48cac8044c6 by Andy Soffer <asoffer@google.com>: Internal changes and combine namespaces into a single namespace. PiperOrigin-RevId: 263560576 -- 8d19f41661984a600d1f8bbfeb8a30fcb4dee7d6 by Mark Barolak <mbar@google.com>: Inside of absl::string_view::copy, use absl::string_view::traits_type::copy instead of std:copy to do the actual work. This both follows the C++ standard more closely and avoids avoid MSVC unchecked iterator warnings. PiperOrigin-RevId: 263430502 -- c06bf74236e12c7c1c97bfcbbc9d29bd65d6b36c by Andy Soffer <asoffer@google.com>: Remove force-inlining attributes. Benchmarking results indicate that they are creating meaningful performance differences. PiperOrigin-RevId: 263364896 -- ec4fa6eac958a9521456201b138784f55d3b17bc by Abseil Team <absl-team@google.com>: Make BM_Fill benchmarks more representative. PiperOrigin-RevId: 263349482 -- 4ae280b4eb31d9cb58e847eb670473340f7778c1 by Derek Mauro <dmauro@google.com>: Fix new -Wdeprecated-copy warning in gcc9 PiperOrigin-RevId: 263348118 -- d238a92f452a5c35686f9c71596fdd1fe62090a2 by Matt Calabrese <calabrese@google.com>: The std::is_trivially_xxx fail on versions of GCC up until 7.4 due to faulty underlying intrinsics, but our emulation succeeds. Update our traits to not compare against the standard library implementation in these versions. PiperOrigin-RevId: 263209457 GitOrigin-RevId: f28b989d5161230c6561e923b458c797a96bcf90 Change-Id: I4c41db5928ba71e243aeace4420e06d1a2df0b5b
Diffstat (limited to 'absl/meta')
-rw-r--r--absl/meta/type_traits_test.cc22
1 files changed, 22 insertions, 0 deletions
diff --git a/absl/meta/type_traits_test.cc b/absl/meta/type_traits_test.cc
index a7a9c5c9..6fbb42f8 100644
--- a/absl/meta/type_traits_test.cc
+++ b/absl/meta/type_traits_test.cc
@@ -546,6 +546,28 @@ TEST(TypeTraitsTest, TestTrivialDefaultCtor) {
#endif
}
+// GCC prior to 7.4 had a bug in its trivially-constructible traits
+// (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80654).
+// This test makes sure that we do not depend on the trait in these cases when
+// implementing absl triviality traits.
+
+template <class T>
+struct BadConstructors {
+ BadConstructors() { static_assert(T::value, ""); }
+
+ BadConstructors(BadConstructors&&) { static_assert(T::value, ""); }
+
+ BadConstructors(const BadConstructors&) { static_assert(T::value, ""); }
+};
+
+TEST(TypeTraitsTest, TestTrivialityBadConstructors) {
+ using BadType = BadConstructors<int>;
+
+ EXPECT_FALSE(absl::is_trivially_default_constructible<BadType>::value);
+ EXPECT_FALSE(absl::is_trivially_move_constructible<BadType>::value);
+ EXPECT_FALSE(absl::is_trivially_copy_constructible<BadType>::value);
+}
+
TEST(TypeTraitsTest, TestTrivialMoveCtor) {
// Verify that arithmetic types and pointers have trivial move
// constructors.