This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of New status.

4021. mdspan::is_always_meow() should be noexcept

Section: 23.7.3.6.1 [mdspan.mdspan.overview] Status: New Submitter: Stephan T. Lavavej Opened: 2023-12-07 Last modified: 2025-10-21

Priority: 3

View all issues with New status.

Discussion:

It can easily be proven that mdspan::is_always_meow() is preconditionless and can never throw exceptions. microsoft/STL has already shipped a noexcept-strengthened implementation, libc++ would like to (see llvm/llvm-project#74254), and together we believe that the Standard should simply mandate noexcept so users can rely on this. The proof is:

Constant expressions can surely be obtained without throwing exceptions.

[2025-10-21; Reflector poll.]

Set priority to 3 after reflector poll.

Use if consteval may lead to exception thrown from invocation of is_always_meow, when evaluated at runtime.

Design intent was for is_always_meow functions to always produce value at compile time. Layout requirements may need to be updated.

Separately, 16.3.2.4 [structure.specifications] says that Result: is just the type and value category; not "constant expression" - this matters because we need to require a prvalue constant expression here.

Proposed resolution:

This wording is relative to N4964.

  1. Modify 23.7.3.6.1 [mdspan.mdspan.overview], class template mdspan synopsis, as indicated:

    […]
    static constexpr bool is_always_unique() noexcept
      { return mapping_type::is_always_unique(); }
    static constexpr bool is_always_exhaustive() noexcept
      { return mapping_type::is_always_exhaustive(); }
    static constexpr bool is_always_strided() noexcept
      { return mapping_type::is_always_strided(); }
    […]