Change array<T, 0>::begin() to return nullptr and make it constexpr.

This commit is contained in:
Peter Dimov
2025-01-26 19:21:39 +02:00
parent 43326390d9
commit 89f09e33f1
2 changed files with 12 additions and 7 deletions

View File

@ -44,7 +44,12 @@ void RunTests()
BOOST_TEST ( const_test_case.begin() == const_test_case.end());
BOOST_TEST ( const_test_case.cbegin() == const_test_case.cend());
BOOST_TEST ( test_case.begin() != const_test_case.begin() );
// BOOST_TEST ( test_case.begin() != const_test_case.begin() );
//
// TR1 specified that begin() must return a unique value for zero-sized
// arrays. However, this makes constexpr unimplementable, and all standard
// libraries have converged on using nullptr instead (see LWG issue 2157.)
if( test_case.data() == const_test_case.data() ) {
// Value of data is unspecified in TR1, so no requirement this test pass or fail
// However, it must compile!