https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121061
Bug ID: 121061 Summary: extents/mdspan constructor is ILL-FORMED for IntegrLike with mutable conversions Product: gcc Version: 16.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: tkaminsk at gcc dot gnu.org Target Milestone: --- For the following code: ``` template<bool Const> class IntLike { public: explicit IntLike(int i) : _M_i(i) { } IntLike() = delete; IntLike(const IntLike&) = delete; IntLike(IntLike&&) = delete; const IntLike& operator=(const IntLike&) = delete; const IntLike& operator=(IntLike&&) = delete; constexpr operator int() const noexcept requires (Const) { return _M_i; } constexpr operator int() noexcept requires (!Const) { return _M_i; } private: int _M_i; }; ``` The static assertion fails incorrectly: static_assert(!std::is_constructible_v<std::extents<int, std::dynamic_extent>, std::array<IntLike<false>, 1>>);. It should be eliminated by https://eel.is/c++draft/mdspan.extents#cons-9.1. We emit the ill-formed error from corresponding cosntructor: std::array<IntLike<false>, 1> a1{IntLike<false>(1)}; std::extents<int, std::dynamic_extent> e1(a1); See: https://godbolt.org/z/6GnqnascY