Passing an uninitialized object to a function that takes its argument by const reference is diagnosed by -Wmaybe-uninitialized because most such functions read the argument. The exceptions are functions that don't access the object but instead use its address to compute a result. This includes a number of std::array member functions such as std::array::size() which returns the template argument N. Such functions may be candidates for attribute const which also avoids the warning. The attribute typically only benefits extern functions that IPA cannot infer the property from, but in this case it helps avoid the warning which runs very early on, even without optimization or inlining. The attached patch adds the attribute to a subset of those member functions of std::array. (It doesn't add it to const member functions like cbegin() or front() that return a const_iterator or const reference to the internal data.) It might be possible to infer this property from inline functions earlier on than during IPA and avoid having to annotate them explicitly. That seems like an enhancement worth considering in the future. Tested on x86_64-linux. Martin