From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id D1AB83946C36 for ; Tue, 29 Mar 2022 09:12:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D1AB83946C36 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-613-npLOzEMwO7iIB85KKIpVcg-1; Tue, 29 Mar 2022 05:12:00 -0400 X-MC-Unique: npLOzEMwO7iIB85KKIpVcg-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 35EF4899EDA; Tue, 29 Mar 2022 09:11:54 +0000 (UTC) Received: from localhost (unknown [10.33.36.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id C0F9314582FD; Tue, 29 Mar 2022 09:11:49 +0000 (UTC) From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed] libstdc++: Workaround for missing 'using enum' in Clang 12 Date: Tue, 29 Mar 2022 10:11:47 +0100 Message-Id: <20220329091147.1611031-1-jwakely@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_NUMSUBJECT, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Tue, 29 Mar 2022 09:12:05 -0000 Tested powerpc64le-linux, pushed to trunk. -- >8 -- Once we no longer care about older compilers without this feature, we can drop these static data members, so the names don't have to be visible at class scope. libstdc++-v3/ChangeLog: * libsupc++/compare (_Strong_order) [!__cpp_using_enum]: Add static data members for _Fp_fmt enumerators. --- libstdc++-v3/libsupc++/compare | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/libstdc++-v3/libsupc++/compare b/libstdc++-v3/libsupc++/compare index 6e1ed53eeed..e9cf9139def 100644 --- a/libstdc++-v3/libsupc++/compare +++ b/libstdc++-v3/libsupc++/compare @@ -677,12 +677,25 @@ namespace std // TODO: _Bfloat16, }; +#ifndef __cpp_using_enum + // XXX Remove these once 'using enum' support is ubiquitous. + static constexpr _Fp_fmt _Binary16 = _Fp_fmt::_Binary16; + static constexpr _Fp_fmt _Binary32 = _Fp_fmt::_Binary32; + static constexpr _Fp_fmt _Binary64 = _Fp_fmt::_Binary64; + static constexpr _Fp_fmt _Binary128 = _Fp_fmt::_Binary128; + static constexpr _Fp_fmt _X86_80bit = _Fp_fmt::_X86_80bit; + static constexpr _Fp_fmt _M68k_80bit = _Fp_fmt::_M68k_80bit; + static constexpr _Fp_fmt _Dbldbl = _Fp_fmt::_Dbldbl; +#endif + // Identify the format used by a floating-point type. template static consteval _Fp_fmt _S_fp_fmt() noexcept { +#ifdef __cpp_using_enum using enum _Fp_fmt; +#endif // Identify these formats first, then assume anything else is IEEE. // N.B. ARM __fp16 alternative format can be handled as binary16. @@ -810,7 +823,9 @@ namespace std return __builtin_bit_cast(int16_t, __val); else { +#ifdef __cpp_using_enum using enum _Fp_fmt; +#endif constexpr auto __fmt = _S_fp_fmt<_Tp>(); if constexpr (__fmt == _X86_80bit || __fmt == _M68k_80bit) { @@ -862,7 +877,9 @@ namespace std if (__ix == __iy) return strong_ordering::equal; // All bits are equal, we're done. +#ifdef __cpp_using_enum using enum _Fp_fmt; +#endif constexpr auto __fmt = _S_fp_fmt<_Tp>(); if constexpr (__fmt == _Dbldbl) // double-double -- 2.34.1