From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 110606 invoked by alias); 13 Jun 2017 15:57:03 -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 110579 invoked by uid 89); 13 Jun 2017 15:57:02 -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,SPF_HELO_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy= X-Spam-User: qpsmtpd, 2 recipients 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; Tue, 13 Jun 2017 15:57:01 +0000 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5A6116611; Tue, 13 Jun 2017 15:57:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 5A6116611 Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=jwakely@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 5A6116611 Received: from localhost (unknown [10.33.36.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0DE0C85921; Tue, 13 Jun 2017 15:57:03 +0000 (UTC) Date: Tue, 13 Jun 2017 15:57:00 -0000 From: Jonathan Wakely To: Pedro Alves Cc: libstdc++@gcc.gnu.org, "gcc-patches@gcc.gnu.org" Subject: Re: [PATCH] Finish implementing P0426R1 "Constexpr for std::char_traits" for C++17 Message-ID: <20170613155703.GD2958@redhat.com> References: <0867f2ad-1381-fdda-2f03-2fdbd450faed@redhat.com> <20170605142734.GO12306@redhat.com> <38d6cdc6-554a-6d0d-e76d-c7d340bf1e75@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <38d6cdc6-554a-6d0d-e76d-c7d340bf1e75@redhat.com> X-Clacks-Overhead: GNU Terry Pratchett User-Agent: Mutt/1.8.0 (2017-02-23) X-SW-Source: 2017-06/txt/msg00958.txt.bz2 On 12/06/17 23:28 +0100, Pedro Alves wrote: >On 06/05/2017 03:27 PM, Jonathan Wakely wrote: > >> Pedro, this is OK for trunk now we're in stage 1. Please go ahead and >> commit it - thanks. > >Thanks Jonathan. I've pushed it in now. > >> >> It's probably safe for gcc-7-branch too, but let's leave it on trunk >> for a while first. > >OK. > >BTW, for extra thoroughness, to confirm we're handling both >const & non-const arrays correctly, I had written this testsuite >tweak too. Would you like to have this in? Yes please, this looks useful. >@@ -98,7 +220,12 @@ static_assert( test_compare>() ); > static_assert( test_length>() ); > static_assert( test_find>() ); > >-struct C { unsigned char c; }; >+struct C >+{ >+ C() = default; >+ constexpr C(auto c_) : c(c_) {} Placeholder types as function parameters are non-standard, so this would fail with -pedantic-errors. How about: struct C { constexpr C(unsigned char c_ = 0) : c(c_) { } unsigned char c; }; >+ unsigned char c; >+}; > constexpr bool operator==(const C& c1, const C& c2) { return c1.c == c2.c; } > constexpr bool operator<(const C& c1, const C& c2) { return c1.c < c2.c; } > static_assert( test_assign>() ); >-- >2.5.5 > >