public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely@redhat.com>
To: Stephan Bergmann <sbergman@redhat.com>
Cc: Marek Polacek <polacek@redhat.com>,
	"libstdc++" <libstdc++@gcc.gnu.org>,
	 GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] c++: Add __reference_con{struc, ver}ts_from_temporary [PR104477]
Date: Tue, 19 Jul 2022 12:10:57 +0100	[thread overview]
Message-ID: <CACb0b4neS0s8VPAB4srH3Tpk=MNwPiRVkUtnL62_HxGomG2qXw@mail.gmail.com> (raw)
In-Reply-To: <CACb0b4kVcPcgc1_bart9MSqOdAkZ5Mn0WzN27C2d0qfuc3whLA@mail.gmail.com>

On Tue, 19 Jul 2022 at 11:08, Jonathan Wakely wrote:
>
> On Sun, 17 Jul 2022 at 22:13, Stephan Bergmann via Libstdc++
> <libstdc++@gcc.gnu.org> wrote:
> >
> > On 7/15/22 22:25, Marek Polacek via Gcc-patches wrote:
> > > Yeah, I guess so.  But I've already pushed the patch.
> >
> > This commit obviously breaks using libstdc++ with Clang (in -std=c++2b
> > mode), which doesn't implement those new builtins.  Something like the
> > below would fix that,
>
> Thanks, Stephan, I'll fix this.

This patch doesn't work, because __has_builtin doesn't detect the new
built-ins. I have a patch that solves that, so we can make the change
to the library headers.

>
> >
> > > diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits
> > > index b1a1deecf66..a6e028b42ec 100644
> > > --- a/libstdc++-v3/include/std/type_traits
> > > +++ b/libstdc++-v3/include/std/type_traits
> > > @@ -3505,6 +3505,7 @@ template<typename _Ret, typename _Fn, typename... _Args>
> > >    template<typename _Tp>
> > >      inline constexpr bool is_scoped_enum_v = is_scoped_enum<_Tp>::value;
> > >
> > > +#if __has_builtin(__reference_constructs_from_temporary) && __has_builtin(__reference_converts_from_temporary)
> > >  #define __cpp_lib_reference_from_temporary 202202L
> > >
> > >    /// True if _Tp is a reference type, a _Up value can be bound to _Tp in
> > > @@ -3544,6 +3545,7 @@ template<typename _Ret, typename _Fn, typename... _Args>
> > >    template<typename _Tp, typename _Up>
> > >      inline constexpr bool reference_converts_from_temporary_v
> > >        = reference_converts_from_temporary<_Tp, _Up>::value;
> > > +#endif
> > >  #endif // C++23
> > >
> > >  #if _GLIBCXX_HAVE_IS_CONSTANT_EVALUATED
> > > diff --git a/libstdc++-v3/include/std/version b/libstdc++-v3/include/std/version
> > > index 5edca2f3007..7c4b7f7cc6d 100644
> > > --- a/libstdc++-v3/include/std/version
> > > +++ b/libstdc++-v3/include/std/version
> > > @@ -304,7 +304,9 @@
> > >  #define __cpp_lib_byteswap 202110L
> > >  #define __cpp_lib_constexpr_typeinfo 202106L
> > >  #define __cpp_lib_is_scoped_enum 202011L
> > > +#if __has_builtin(__reference_constructs_from_temporary) && __has_builtin(__reference_converts_from_temporary)
> > >  #define __cpp_lib_reference_from_temporary 202202L
> > > +#endif
> > >
> > >  #if _GLIBCXX_HOSTED
> > >  #define __cpp_lib_adaptor_iterator_pair_constructor 202106L
> >


  reply	other threads:[~2022-07-19 11:11 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-08 17:41 Marek Polacek
2022-07-11 10:19 ` Jonathan Wakely
2022-07-12 17:16   ` [PATCH v2] c++: Add __reference_con{struc,ver}ts_from_temporary [PR104477] Marek Polacek
2022-07-12 20:10 ` [PATCH] " Jason Merrill
2022-07-12 20:15   ` Jason Merrill
2022-07-14 17:43     ` Marek Polacek
2022-07-15  3:48       ` Jason Merrill
2022-07-15 15:32         ` Marek Polacek
2022-07-15 19:59           ` [PATCH] c++: Add __reference_con{struc, ver}ts_from_temporary [PR104477] Ville Voutilainen
2022-07-15 20:25             ` [PATCH] c++: Add __reference_con{struc,ver}ts_from_temporary [PR104477] Marek Polacek
2022-07-17 21:12               ` Stephan Bergmann
2022-07-19 10:08                 ` [PATCH] c++: Add __reference_con{struc, ver}ts_from_temporary [PR104477] Jonathan Wakely
2022-07-19 11:10                   ` Jonathan Wakely [this message]
2022-07-19 14:14                     ` Jonathan Wakely
2022-07-14 17:41   ` [PATCH v3] c++: Add __reference_con{struc,ver}ts_from_temporary [PR104477] Marek Polacek

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='CACb0b4neS0s8VPAB4srH3Tpk=MNwPiRVkUtnL62_HxGomG2qXw@mail.gmail.com' \
    --to=jwakely@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=libstdc++@gcc.gnu.org \
    --cc=polacek@redhat.com \
    --cc=sbergman@redhat.com \
    /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).