[libcxx-commits] [PATCH] D69466: Guard against overflow in span::subspan

Michael Schellenberger Costa via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Dec 18 05:08:51 PST 2019


miscco added a comment.

I removed the  `static_assert` from the `front()` and `back()` method and added the appropriate `_LIBCPP_ASSERT` instead.

The problem is that the following code would otherwise break:

  if (!s.empty()) {
      s.front()
  }

As far as I understand we cannot use `is_constant_evaluated()` as that would still require the compiler to process the branch and trigger the `static_assert`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D69466





More information about the libcxx-commits mailing list