[PATCH] D34237: Mark the operations of __wrap_iter as constexpr

Eric Fiselier via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 15 18:44:37 PDT 2017


EricWF added a comment.

A large portion of this patch is UB. Any function that unconditionally calls `__get_db()` can never be a valid constant expression, hence UB.

Is there a smaller set of operations or `__wrap_iter` that *must* be made constexpr? Or do they all need to be?



================
Comment at: include/algorithm:1765
 template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
 typename enable_if
----------------
These definitions should probably be moved to `<iterator>` where they are declared. I'm not sure why they lived in `<algorithm>` to begin with.


================
Comment at: include/iterator:1202
 template <class _Iter1, class _Iter2>
-_LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
 bool
----------------
These forward declarations seem unnecessary since they're also forward declared as friend functions inside `__wrap_iter`


https://reviews.llvm.org/D34237





More information about the cfe-commits mailing list