From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by sourceware.org (Postfix) with ESMTP id 22F02395BC57 for ; Thu, 23 Apr 2020 20:44:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 22F02395BC57 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-242-IParyI1LN2SL0qaFA1tjuA-1; Thu, 23 Apr 2020 16:44:19 -0400 X-MC-Unique: IParyI1LN2SL0qaFA1tjuA-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BD98545F; Thu, 23 Apr 2020 20:44:18 +0000 (UTC) Received: from localhost (unknown [10.33.36.131]) by smtp.corp.redhat.com (Postfix) with ESMTP id 684FA1C953; Thu, 23 Apr 2020 20:44:18 +0000 (UTC) Date: Thu, 23 Apr 2020 21:44:17 +0100 From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: Re: [committed 7/8] libstdc++: Update (and revert) value of __cpp_lib_array_constexpr Message-ID: <20200423204417.GR71320@redhat.com> References: MIME-Version: 1.0 In-Reply-To: X-Clacks-Overhead: GNU Terry Pratchett X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: multipart/mixed; boundary="n8884J15jRwcBTvu" Content-Disposition: inline X-Spam-Status: No, score=-28.4 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libstdc++@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++ mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Apr 2020 20:44:23 -0000 --n8884J15jRwcBTvu Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 22/04/20 22:59 +0100, Jonathan Wakely wrote: >This macro should have been updated to 201811 when the last C++20 >changes were implemented. However those changes are not enabled for >C++17 mode, so the macro should only have the new value in C++20 mode. > >This change ensures that the macro is defined to 201603 for C++17 and >201811 for C++20. > >=09* include/bits/stl_iterator.h (__cpp_lib_array_constexpr): Define >=09different values for C++17 and C++20, to indicate different feature >=09sets. Update value for C++20 to indicate P1032R1 support. >=09* include/std/version (__cpp_lib_array_constexpr): Likewise. >=09* testsuite/23_containers/array/comparison_operators/constexpr.cc: >=09Check feature test macro. >=09* testsuite/23_containers/array/element_access/constexpr_c++17.cc: >=09New test. >=09* testsuite/23_containers/array/requirements/constexpr_fill.cc: Check >=09feature test macro. >=09* testsuite/23_containers/array/requirements/constexpr_iter.cc: Test >=09in C++17 mode and check feature test macro. On second thoughts, changing __cpp_lib_array_constexpr for C++17 was wrong, it should have been left at 201803. This partially reverts my previous change related to this macro. The C++20 constexpr iterator requirements are always met by array:iterator, because it's just a pointer. So the macro can be set to 201803 even in C++17 mode. Tested powerpc64le-linux, committed to master. --n8884J15jRwcBTvu Content-Type: text/x-patch; charset=us-ascii Content-Disposition: attachment; filename="patch.txt" Content-Transfer-Encoding: quoted-printable commit 40541efe1c063e9ce894b5f11ff727e4aec56e8b Author: Jonathan Wakely Date: Thu Apr 23 21:39:33 2020 +0100 libstdc++: Change __cpp_lib_array_constexpr for C++17 again =20 This partially reverts my previous change related to this macro. The C++20 constexpr iterator requirements are always met by array:iterator, because it's just a pointer. So the macro can be set to 201803 even in C++17 mode. =20 * include/bits/stl_iterator.h (__cpp_lib_array_constexpr): Reve= rt value for C++17 to 201803L because P0858R0 is supported for C++= 17. * include/std/version (__cpp_lib_array_constexpr): Likewise. * testsuite/23_containers/array/element_access/constexpr_c++17.= cc: Check for value corresponding to P0031R0 features being tested. * testsuite/23_containers/array/requirements/constexpr_iter.cc: Check for value corresponding to P0858R0 features being tested. diff --git a/libstdc++-v3/include/bits/stl_iterator.h b/libstdc++-v3/includ= e/bits/stl_iterator.h index d7e85b84041..cc0b3e0a766 100644 --- a/libstdc++-v3/include/bits/stl_iterator.h +++ b/libstdc++-v3/include/bits/stl_iterator.h @@ -72,7 +72,7 @@ #if __cplusplus > 201703L # define __cpp_lib_array_constexpr 201811L #elif __cplusplus =3D=3D 201703L -# define __cpp_lib_array_constexpr 201603L +# define __cpp_lib_array_constexpr 201803L #endif =20 #if __cplusplus > 201703L diff --git a/libstdc++-v3/include/std/version b/libstdc++-v3/include/std/ve= rsion index 1beb9aa938e..fa505f25e98 100644 --- a/libstdc++-v3/include/std/version +++ b/libstdc++-v3/include/std/version @@ -123,7 +123,7 @@ #if _GLIBCXX_HOSTED #define __cpp_lib_any 201606L #define __cpp_lib_apply 201603 -#define __cpp_lib_array_constexpr 201603L +#define __cpp_lib_array_constexpr 201803L #define __cpp_lib_as_const 201510 #define __cpp_lib_boyer_moore_searcher 201603 #define __cpp_lib_chrono 201611 diff --git a/libstdc++-v3/testsuite/23_containers/array/element_access/cons= texpr_c++17.cc b/libstdc++-v3/testsuite/23_containers/array/element_access/= constexpr_c++17.cc index 56d1cf256be..dd69645833f 100644 --- a/libstdc++-v3/testsuite/23_containers/array/element_access/constexpr_c= ++17.cc +++ b/libstdc++-v3/testsuite/23_containers/array/element_access/constexpr_c= ++17.cc @@ -24,8 +24,6 @@ # error "Feature test macro for array constexpr is missing in " #elif __cpp_lib_array_constexpr < 201603L # error "Feature test macro for array constexpr has wrong value in = " -#elif __cpp_lib_array_constexpr > 201603L && __cplusplus =3D=3D 201703 -# error "Feature test macro for array constexpr has wrong value for C++17" #endif =20 constexpr std::size_t test01() diff --git a/libstdc++-v3/testsuite/23_containers/array/requirements/conste= xpr_iter.cc b/libstdc++-v3/testsuite/23_containers/array/requirements/const= expr_iter.cc index a119937f773..566388405b6 100644 --- a/libstdc++-v3/testsuite/23_containers/array/requirements/constexpr_ite= r.cc +++ b/libstdc++-v3/testsuite/23_containers/array/requirements/constexpr_ite= r.cc @@ -22,12 +22,13 @@ =20 #ifndef __cpp_lib_array_constexpr # error "Feature test macro for array constexpr is missing in " -#elif __cpp_lib_array_constexpr < 201603L +#elif __cpp_lib_array_constexpr < 201803L # error "Feature test macro for array constexpr has wrong value in = " -#elif __cpp_lib_array_constexpr > 201603L && __cplusplus =3D=3D 201703 -# error "Feature test macro for array constexpr has wrong value for C++17" #endif =20 +// This test is compiled as C++17 because array::iterator is just a pointe= r, +// so always meets the C++20 constexpr iterator requirements, even in C++1= 7. + constexpr int test() { --n8884J15jRwcBTvu--