[libc-commits] [PATCH] D150211: [libc] Extend optional to support non trivially destructible objects

Mikhail Ramalho via Phabricator via libc-commits libc-commits at lists.llvm.org
Tue Aug 15 10:15:16 PDT 2023


mikhail.ramalho reopened this revision.
mikhail.ramalho added a comment.
This revision is now accepted and ready to land.

@michaelrj can you take another look at the changes at type_traits.h?

I had to add this code because gcc doesn't have `__is_trivially_destructible` and here's an explanation of why we can't only use gcc's `__has_trivial_destructor` (link <https://stackoverflow.com/questions/20181702/which-type-traits-cannot-be-implemented-without-compiler-hooks>):

  For historical reasons, the name of this compiler builtin is not __is_trivially_destructible(T)
  but rather __has_trivial_destructor(T). Furthermore, it turns out that the builtin evaluates to
  true even for a class type with a deleted destructor! So we first need to check that the type is
  destructible; and then, if it is, we can ask the magic builtin whether that destructor is indeed trivial.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D150211/new/

https://reviews.llvm.org/D150211



More information about the libc-commits mailing list