From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 38412 invoked by alias); 16 Oct 2019 09:43:12 -0000 Mailing-List: contact libstdc++-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libstdc++-owner@gcc.gnu.org Received: (qmail 38396 invoked by uid 89); 16 Oct 2019 09:43:12 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-4.1 required=5.0 tests=AWL,BAYES_00,KAM_SHORT,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 16 Oct 2019 09:43:10 +0000 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8872E2D6A25; Wed, 16 Oct 2019 09:43:09 +0000 (UTC) Received: from localhost (unknown [10.33.36.149]) by smtp.corp.redhat.com (Postfix) with ESMTP id 34A7B5C1D6; Wed, 16 Oct 2019 09:43:09 +0000 (UTC) Date: Wed, 16 Oct 2019 09:43:00 -0000 From: Jonathan Wakely To: Romain Geissler Cc: libstdc++@gcc.gnu.org, GCC Patches Subject: Re: [PATCH] Use __is_same_as for std::is_same and std::is_same_v Message-ID: <20191016094308.GH4169@redhat.com> References: <20191011155009.GA20051@redhat.com> <20191016094207.GG4169@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20191016094207.GG4169@redhat.com> X-Clacks-Overhead: GNU Terry Pratchett User-Agent: Mutt/1.12.1 (2019-06-15) X-IsSubscribed: yes X-SW-Source: 2019-10/txt/msg00070.txt.bz2 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 >> 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.