public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely@redhat.com>
To: Romain Geissler <romain.geissler@gmail.com>
Cc: libstdc++@gcc.gnu.org, GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] Use __is_same_as for std::is_same and std::is_same_v
Date: Wed, 16 Oct 2019 09:43:00 -0000	[thread overview]
Message-ID: <20191016094308.GH4169@redhat.com> (raw)
In-Reply-To: <20191016094207.GG4169@redhat.com>

On 16/10/19 10:42 +0100, Jonathan Wakely wrote:
>On 12/10/19 18:15 +0200, Romain Geissler wrote:
>>Le sam. 12 oct. 2019 à 17:44, Romain Geissler
>><romain.geissler@gmail.com> a écrit :
>>>
>>>It looks like this creates the following error when I try to bootstrap
>>>clang 9.0.0 using the latest gcc and libstdc++ from trunk. Note that
>>>with g++, there is no problem, however it looks like clang++ has some
>>>problem with the new header. I don't know if this is an issue on
>>>libstdc++ side or clang++ side.
>>
>>__is_same_as is not implemented as a compiler builtin in clang++
>
>Sigh, I guess that explains why we weren't using it already.
>
>>unlike g++, thus the error on clang 9.0.0 side. It looks like current
>>clang trunk doesn't define __is_same_as either. Until clang implements
>>this support (if it ever will), usage of __is_same_as in libstdc++
>>shall be conditional, only when __has_builtin(__is_same_as) is true
>>(however that would require that gcc implements __has_builtin, as
>>implemented here:
>>https://gcc.gnu.org/ml/gcc-patches/2019-10/msg00062.html )
>
>No, we don't need GCC to support __has_builtin, because we know GCC
>supports __is_same_as so there's no need to check for it.
>
>So something like this would work fine:
>
>#if __GNUC__ >= 10
># define _GLIBCXX_HAVE__IS_SAME_AS
>#elif defined(__has_builtin)
># if __has_builtin(__is_same_as)
>#  define _GLIBCXX_HAVE__IS_SAME_AS
># endif
>#endif

It looks like Clang provides __is_same instead.

I'll commit a fix today.


  reply	other threads:[~2019-10-16  9:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-11 15:50 Jonathan Wakely
2019-10-12 15:43 ` Romain Geissler
2019-10-12 16:14   ` Romain Geissler
2019-10-16  9:42     ` Jonathan Wakely
2019-10-16  9:43       ` Jonathan Wakely [this message]
2019-10-16 10:26         ` Jonathan Wakely

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=20191016094308.GH4169@redhat.com \
    --to=jwakely@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=libstdc++@gcc.gnu.org \
    --cc=romain.geissler@gmail.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).