The following code:
std::array arr1;
std::array arr2;
...compiles with both gcc and
I think this is a related to CWG issue 1684. Previously, the constexpr requirements included:
The class of which a
constexprfunction is a member shall be a literal type
And std::array<std::vector<int>, 4> is not a literal type, and hence its size() member function would not be constexpr. However, the new wording allows for a constexpr non-static member functions for non-literal types, assuming those functions meet all the other requirements of constexpr (which array<T,N>::size() clearly does).
Per the new wording, this is a gcc bug. Previously filed as 66297.