How to obtain constexpr `.size()` of a non-static std::array member
问题 Given that std::array<T,N>::size is constexpr, in the snippet below Why does it matter that Foo1::u is not a static member? The type is known at compile time and so is its size() . What's wrong with Foo2::bigger() ? Listing: // x86-64 gcc 10.1 // -O3 --std=c++20 -pedantic -Wall -Werror #include <array> #include <cstdint> union MyUnion { std::array<uint8_t,32> bytes; std::array<uint32_t,8> words; }; struct Foo1 { MyUnion u; static constexpr size_t length {u.bytes.size()}; //invalid use of non