public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jonathan Wakely <redi@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org
Subject: [gcc r12-7874] libstdc++: Workaround for missing 'using enum' in Clang 12
Date: Tue, 29 Mar 2022 09:11:22 +0000 (GMT)	[thread overview]
Message-ID: <20220329091122.4A49F3888825@sourceware.org> (raw)

https://gcc.gnu.org/g:8bbeffc102bdd0a69576a8df47c588aba5a9b529

commit r12-7874-g8bbeffc102bdd0a69576a8df47c588aba5a9b529
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Mon Mar 28 12:27:23 2022 +0100

    libstdc++: Workaround for missing 'using enum' in Clang 12
    
    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.

Diff:
---
 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<typename _Tp>
 	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


                 reply	other threads:[~2022-03-29  9:11 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220329091122.4A49F3888825@sourceware.org \
    --to=redi@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    --cc=libstdc++-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).