[libcxx-commits] [PATCH] D60666: Fix some constexpr members in array<T, 0>

Zoe Carver via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sat Jun 15 11:57:12 PDT 2019


zoecarver marked an inline comment as done.
zoecarver added inline comments.


================
Comment at: include/array:315
     // element access:
-    _LIBCPP_INLINE_VISIBILITY
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
     reference operator[](size_type) _NOEXCEPT {
----------------
ldionne wrote:
> This can't be marked `constexpr` because it never produces a constant expression.
You're right. I did not implement/test this properly. There are two things I could do. A) I could remove the `constexpr` from these methods which would make them error at runtime or B) I could add a non-`constexpr` `static_assert` that would fail when one of these methods was used in a program at compile time. I think the later might be UB. Thoughts? 


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

https://reviews.llvm.org/D60666





More information about the libcxx-commits mailing list