[Bug libstdc++/96851] operator< on std::array<T, N> does not work in constexpr, for sizeof(T) == 1, and N > 1

milasudril at gmail dot com gcc-bugzilla@gcc.gnu.org
Wed Sep 2 15:17:25 GMT 2020


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96851

--- Comment #4 from milasudril at gmail dot com ---
Actually, I did not even try without the c++20 flag:

template< class T, std::size_t N >
bool operator<( const std::array<T,N>& lhs,
                const std::array<T,N>& rhs );
        (3)     (until C++20)

...

template< class T, std::size_t N >
constexpr /* see below */ operator<=>( const std::array<T,N>& lhs,
                                       const std::array<T,N>& rhs );
        (7)     (since C++20)

https://en.cppreference.com/w/cpp/container/array/operator_cmp

Thus I wouldn't expect it to work in C++17 or below. If it did, it could be
considered a bug.


More information about the Gcc-bugs mailing list