[libcxx-commits] [PATCH] D68756: [libc++][test] Change IsSmallObject's calculation for std::any's small object buffer

Casey Carter via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Oct 9 18:50:16 PDT 2019


CaseyCarter created this revision.
CaseyCarter added reviewers: mclow.lists, EricWF, ldionne.
CaseyCarter added a project: libc++.
Herald added subscribers: libcxx-commits, dexonsmith, christof.

`sizeof(std::any) - sizeof(void*)` is correct for both libc++ and the MSVC standard library.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D68756

Files:
  libcxx/test/support/any_helpers.h


Index: libcxx/test/support/any_helpers.h
===================================================================
--- libcxx/test/support/any_helpers.h
+++ libcxx/test/support/any_helpers.h
@@ -26,13 +26,13 @@
 template <class T>
   struct IsSmallObject
     : public std::integral_constant<bool
-        , sizeof(T) <= (sizeof(void*)*3)
+        , sizeof(T) <= sizeof(std::any) - sizeof(void*)
           && std::alignment_of<void*>::value
              % std::alignment_of<T>::value == 0
           && std::is_nothrow_move_constructible<T>::value
         >
   {};

 template <class T>
 bool containsType(std::any const& a) {
 #if !defined(TEST_HAS_NO_RTTI)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68756.224233.patch
Type: text/x-patch
Size: 655 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20191010/6b0d1f04/attachment.bin>


More information about the libcxx-commits mailing list