From c806d39182c1aa6c647d044d19d58aad9f5c95df Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Thu, 18 Jan 2018 11:26:24 +0000 Subject: [ADT] Split optional to only include copy mechanics and dtor for non-trivial types. This makes uses of Optional more transparent to the compiler (and clang-tidy) and generates slightly smaller code. This is a re-land of r317019, which had issues with GCC 4.8 back then. Those issues don't reproduce anymore, but I'll watch the buildbots closely in case anything goes wrong. llvm-svn: 322838 --- llvm/unittests/ADT/OptionalTest.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'llvm/unittests/ADT/OptionalTest.cpp') diff --git a/llvm/unittests/ADT/OptionalTest.cpp b/llvm/unittests/ADT/OptionalTest.cpp index 46d4fe0780c..a9a37bf820d 100644 --- a/llvm/unittests/ADT/OptionalTest.cpp +++ b/llvm/unittests/ADT/OptionalTest.cpp @@ -518,5 +518,14 @@ TEST_F(OptionalTest, OperatorGreaterEqual) { CheckRelation(InequalityLhs, InequalityRhs, !IsLess); } +#if (__has_feature(is_trivially_copyable) && defined(_LIBCPP_VERSION)) || \ + (defined(__GNUC__) && __GNUC__ >= 5) +static_assert(std::is_trivially_copyable>::value, + "Should be trivially copyable"); +static_assert( + !std::is_trivially_copyable>::value, + "Shouldn't be trivially copyable"); +#endif + } // end anonymous namespace -- cgit v1.2.3