[PATCH] D54472: Disable invalid isPodLike<> specialization

serge via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 16 06:02:43 PST 2019


serge-sans-paille marked an inline comment as done.
serge-sans-paille added inline comments.


================
Comment at: include/llvm/ADT/PointerIntPair.h:133
+#if !defined(NDEBUG) && (__has_feature(is_trivially_copyable) || (defined(__GNUC__) && __GNUC__ >= 5))
+  static_assert(std::is_trivially_copyable<PointerIntPair<PointerTy, IntBits, IntType, PtrTraits, Info>>::value, "inconsistent behavior between llvm:: and std:: is_trivially_copyable");
+#endif
----------------
rsmith wrote:
> I am confused by this. If the type in question is incomplete, how can this `static_assert` work? (And if it's complete, why do you need the specialization at all?) Have you made sure this actually compiles in a Debug build?
> 
> If you need this, I think what you should probably do instead is to put this `static_assert` inside `PointerIntPair`, in some member function that is commonly instantiated, such as the default constructor. (It can't go in the body of the class itself because the class isn't complete there.)
>  If the type in question is incomplete, how can this static_assert work?

My *guess* is that `std::is_trivially_copyable` 

> Have you made sure this actually compiles in a Debug build?

yes. Double checked right now!


Repository:
  rL LLVM

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

https://reviews.llvm.org/D54472





More information about the llvm-commits mailing list