This combines the overloads for arrays with the non-array overloads, using if-constexpr to choose between the cases, and also enforces the following: - ADL should only be used for class types and enumeration types. - ranges::begin should be ill-formed for rvalue arrays. - ranges::end should be ill-formed for rvalue arrays, unbounded arrays, and arrays of incomplete type. - ranges::size should be ill-formed for unbounded arrays. * include/bits/range_access.h (ranges::begin): Combine array and non-array overloads into one function template. Only use ADL for classes and enums (ranges::end, ranges::size): Likewise. Make unbounded arrays ill-formed. (ranges::rbegin, ranges::rend): Only use ADL for classes and enums. Reformat _S_noexcept() functions to mirror operator() structure. * testsuite/std/ranges/access/begin.cc: Check incomplete array. * testsuite/std/ranges/access/end_neg.cc: New test. * testsuite/std/ranges/access/size.cc: Check array of incomplete type. * testsuite/std/ranges/access/size_neg.cc: New test. This implements what the standard *should* say, not what's in the current draft. I submitted a ballot comment about the unbounded arrays part and have been talking to Casey Carter about cleaning up the spec to match what this patch implements. Tested powerpc64le-linux, committed to trunk.