220 31758 <f8590f49-fb6f-ee08-7fd6-a4b160066143@scylladb.com> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Avi Kivity <avi@scylladb.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Allow constexpr static data members in a literal type.
Date: Sun, 26 Mar 2017 17:50:36 +0300
Organization: ScyllaDB
Lines: 46
Approved: news@gmane.org
Message-ID: <f8590f49-fb6f-ee08-7fd6-a4b160066143@scylladb.com>
References: <dfb9f65c-ea1d-e92b-85e0-333efed1aec5@scylladb.com>
 <CAFk2RUa1uC+tvkBBYevwNFo=h-oW7UXyBFXbnfoqmCAWFTEfOw@mail.gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
X-Trace: blaine.gmane.org 1490539845 28020 195.159.176.226 (26 Mar 2017 14:50:45 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Sun, 26 Mar 2017 14:50:45 +0000 (UTC)
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
 Thunderbird/45.8.0
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBDHJFOWD7YCRBP5K37DAKGQEMVHHUMY@isocpp.org Sun Mar 26 16:50:40 2017
Return-path: <std-proposals+bncBDHJFOWD7YCRBP5K37DAKGQEMVHHUMY@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-wr0-f200.google.com ([209.85.128.200])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBDHJFOWD7YCRBP5K37DAKGQEMVHHUMY@isocpp.org>)
	id 1cs9V3-0006Aa-E7
	for gclcip-std-proposals@m.gmane.org; Sun, 26 Mar 2017 16:50:33 +0200
Original-Received: by mail-wr0-f200.google.com with SMTP id r71sf17557002wrb.17
        for <gclcip-std-proposals@m.gmane.org>; Sun, 26 Mar 2017 07:50:39 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=subject:to:references:from:organization:message-id:date:user-agent
         :mime-version:in-reply-to:x-original-sender
         :x-original-authentication-results:reply-to:precedence:mailing-list
         :list-id:x-spam-checked-in-group:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=CqZQ3DRbGKktpnvyBp1UYVhuss6b0uNTlVUB296TQmA=;
        b=kZN2i21FkQ7zAhkys0t0vDzcff/c563m15b2lUgNOraYpo16dTXbP5b4HFUufvHw8A
         wm6iZYA11aToMpPGkt27JNjEyZTAwx8gwVCxxoUV9A/AWAKoJA9kZbGGplLGKE198ZG1
         7jD1IZie3zHEZXxnr86pMazb7e18mnk4E0XUsIUUWLZBh91lt7EHZNm7aH9RP3B/bI9b
         HscioX4ZV0ntxJ1MuyfEvO/inGH7UCatg0OMaR/oTc8CKa4Dr8gUWynNn0hB4LU+aTfu
         ypbAE/UH1RSh8e0hwfBNMAv5V2yqwFJ9FI4vnLz2XolZFvwgyUWr1WZCFil2KQkDbr/7
         I4IA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:subject:to:references:from:organization
         :message-id:date:user-agent:mime-version:in-reply-to
         :x-original-sender:x-original-authentication-results:reply-to
         :precedence:mailing-list:list-id:x-spam-checked-in-group:list-post
         :list-help:list-archive:list-subscribe:list-unsubscribe;
        bh=CqZQ3DRbGKktpnvyBp1UYVhuss6b0uNTlVUB296TQmA=;
        b=CZ3CXjRtRRsuL4d57ub3Mobur14pfMcw74UK0ZO+V6w0htU2O9LKxo4O3IeAOGoiI1
         /o+1/0d76rY2UeQWuGz6YqLGDikLlXw23GsbV5HP5EIUl4HjBm4u0D3Zx4if9rSdgf7l
         d3q+K4BVW/sujQNg7h0idIUd+xsKyqms5mb8x4oI9o5jzG/olomYQFHPD35m5dCzlXQr
         W552LiGrUr8Je3TpssgnOy3WMuErrqxowI8Hg6ZOzqzpAO7xc7eivl+dy4nkOuPVXyGB
         fJz65nJ4f35+bkEPgDT+T4mF0H+SDpxUH534w5XnBNvOOSV8s3vmetJggJgb2QuyvIoY
         D8Rg= 
X-Gm-Message-State: AFeK/H0MtIz+Zh6SD9oSlBSn96iwGhNpbYNnDQf77s/qlVWawnqaWp7MrZayBOWOUAMs7A==
X-Received: by 10.28.91.19 with SMTP id p19mr218432wmb.16.1490539839693;
        Sun, 26 Mar 2017 07:50:39 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.28.199.3 with SMTP id x3ls965861wmf.16.canary-gmail; Sun, 26
 Mar 2017 07:50:38 -0700 (PDT)
X-Received: by 10.28.225.69 with SMTP id y66mr588354wmg.84.1490539838761;
        Sun, 26 Mar 2017 07:50:38 -0700 (PDT)
Original-Received: from mail-wr0-x235.google.com (mail-wr0-x235.google.com. [2a00:1450:400c:c0c::235])
        by mx.google.com with ESMTPS id r69si10796596wmd.71.2017.03.26.07.50.38
        for <std-proposals@isocpp.org>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Sun, 26 Mar 2017 07:50:38 -0700 (PDT)
Received-SPF: pass (google.com: domain of avi@scylladb.com designates 2a00:1450:400c:c0c::235 as permitted sender) client-ip=2a00:1450:400c:c0c::235;
Original-Received: by mail-wr0-x235.google.com with SMTP id w43so11223128wrb.0
        for <std-proposals@isocpp.org>; Sun, 26 Mar 2017 07:50:38 -0700 (PDT)
X-Received: by 10.223.134.98 with SMTP id 31mr17970708wrw.69.1490539838463;
        Sun, 26 Mar 2017 07:50:38 -0700 (PDT)
Original-Received: from avi.cloudius-systems.com ([37.142.229.250])
        by smtp.gmail.com with ESMTPSA id a10sm10234894wra.17.2017.03.26.07.50.37
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Sun, 26 Mar 2017 07:50:38 -0700 (PDT)
In-Reply-To: <CAFk2RUa1uC+tvkBBYevwNFo=h-oW7UXyBFXbnfoqmCAWFTEfOw@mail.gmail.com>
X-Original-Sender: avi@scylladb.com
X-Original-Authentication-Results: mx.google.com;       dkim=pass
 header.i=@scylladb-com.20150623.gappssmtp.com;       spf=pass (google.com:
 domain of avi@scylladb.com designates 2a00:1450:400c:c0c::235 as permitted
 sender) smtp.mailfrom=avi@scylladb.com
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <std-proposals.isocpp.org>
X-Google-Group-Id: 399137483710
List-Post: <https://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <https://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <https://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:std-proposals+subscribe@isocpp.org>
List-Unsubscribe: <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>,
 <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:31758
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/31758>

On 03/26/2017 05:35 PM, Ville Voutilainen wrote:
> On 26 March 2017 at 17:30, Avi Kivity <avi@scylladb.com> wrote:
>> Consider this type-safe bool class:
>>
>>
>>    template <typename Tag>
>>
>>    class bool_class {
>>
>>        bool _value;
>>
>>    public:
>>
>>        explicit constexpr bool_class(bool v) noexcept : _value(v) {}
>>
>>        // more emulation of bool
>>
>>        static constexpr bool_class yes = bool_class{true};
>>
>>        static constexpr bool_class no = bool_class{true};
>>
>>    };
>>
>>
>> Compilation fails, I believe rightly, on clang, because by the time yes and
>> no are parsed, bool_class is an incomplete type, and therefore not a literal
>> type.  It could be worked around by making yes and no functions.
>>
>> Should we make this legal?  It seems reasonable for types to offer constants
>> scoped under their own name, and if they are literal types, that these
>> constants can be constexpr.
>
> This is US 24 in
> http://open-std.org/JTC1/SC22/WG21/docs/papers/2016/p0488r0.pdf. The
> comment was rejected
> for C++17 due to lack of a proper proposal and the timing.
>

Thanks.  I hope to see this corrected in the future.

-- 
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/f8590f49-fb6f-ee08-7fd6-a4b160066143%40scylladb.com.

.
