From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 40510 invoked by alias); 4 Sep 2017 15:48:54 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 40492 invoked by uid 89); 4 Sep 2017 15:48:53 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=sk:daniel, song, songs, absence 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; Mon, 04 Sep 2017 15:48:48 +0000 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 37A4D4D4C6; Mon, 4 Sep 2017 15:48:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 37A4D4D4C6 Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=jwakely@redhat.com Received: from localhost (unknown [10.33.36.109]) by smtp.corp.redhat.com (Postfix) with ESMTP id C9C8381530; Mon, 4 Sep 2017 15:48:46 +0000 (UTC) Date: Mon, 04 Sep 2017 15:48:00 -0000 From: Jonathan Wakely To: Daniel =?iso-8859-1?Q?Kr=FCgler?= Cc: Tim Song , libstdc++@gnu.org, gcc-patches Subject: Re: [PATCH] PR libstdc++/79162 ambiguity in string assignment due to string_view overload (LWG 2946) Message-ID: <20170904154846.GY4582@redhat.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Clacks-Overhead: GNU Terry Pratchett User-Agent: Mutt/1.8.3 (2017-05-23) X-SW-Source: 2017-09/txt/msg00194.txt.bz2 On 30/07/17 15:01 +0200, Daniel Krügler wrote: >2017-07-28 22:40 GMT+02:00 Daniel Krügler : >> 2017-07-28 22:29 GMT+02:00 Daniel Krügler : >>> 2017-07-28 22:25 GMT+02:00 Tim Song : >>>> On Fri, Jul 28, 2017 at 4:10 PM, Daniel Krügler >>>> wrote: >>>>> + // Performs an implicit conversion from _Tp to __sv_type. >>>>> + template >>>>> + static __sv_type _S_to_string_view(const _Tp& __svt) >>>>> + { >>>>> + return __svt; >>>>> + } >>>> >>>> I might have gone for >>>> >>>> + static __sv_type _S_to_string_view(__sv_type __svt) noexcept >>>> + { >>>> + return __svt; >>>> + } >>>> >>>> With that, we can also use noexcept(_S_to_string_view(__t)) to make up >>>> for the absence of is_nothrow_convertible (basically the same thing I >>>> did in LWG 2993's PR). >>> >>> Agreed, that makes very much sense. I will adjust the P/R, but before >>> I resubmit I would like to get feedback whether the other two compare >>> functions also should become conditionally noexcept. >> >> Locally I have now performed the sole change of the _S_to_string_view >> declaration getting rid of the template, but would also like to gather >> feedback from the maintainers whether I should also change the form of >> the conditional noexcept to use the expression >> >> noexcept(_S_to_string_view(__t)) >> >> instead of the current >> >> is_same<_Tp, __sv_type>::value >> >> as suggested by Tim Song. >> >> I'm asking also, because I have a paper proposing to standardize >> is_nothrow_convertible submitted for the upcoming C++ mailing - This >> would be one of the first applications in the library ;-) > >A slightly revised patch update: It replaces the _S_to_string_view >template by a simpler _S_to_string_view function as of Tim Song's >suggestion, but still uses the simplified noexcept specification >deferring it to a future application case for is_nothrow_convertible. >Furthermore now all three compare function templates are now >(conditionally) noexcept by an (off-list) suggestion from Jonathan >Wakely. I've committed this, after some whitespace fixes and testing. Thanks!