220 32271 <590903D9.2020007@gmx.net> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Jens Maurer <Jens.Maurer@gmx.net>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Re: Allow constexpr static data members in a
 literal type.
Date: Wed, 03 May 2017 00:10:33 +0200
Lines: 43
Approved: news@gmane.org
Message-ID: <590903D9.2020007@gmx.net>
References: <dfb9f65c-ea1d-e92b-85e0-333efed1aec5@scylladb.com> <61acd2a4-d2f8-41ef-849a-0c47cee485d1@isocpp.org> <285f811f-044a-4121-a107-c463bd0693e1@isocpp.org> <CAOfiQqmTeRnDL9mTSyo49f+zjgwiY4C+hUKp=HD715K1i7S3fw@mail.gmail.com> <656c7e88-fcc7-7c8b-dd18-57ff30bee982@scylladb.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
X-Trace: blaine.gmane.org 1493763042 3938 195.159.176.226 (2 May 2017 22:10:42 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Tue, 2 May 2017 22:10:42 +0000 (UTC)
User-Agent: Mozilla/5.0 (X11; Linux i686; rv:6.0.1) Gecko/20110830 Thunderbird/6.0.1
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBDPMTYGK64JRBXEHUTEAKGQEUACNVAQ@isocpp.org Wed May 03 00:10:38 2017
Return-path: <std-proposals+bncBDPMTYGK64JRBXEHUTEAKGQEUACNVAQ@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+bncBDPMTYGK64JRBXEHUTEAKGQEUACNVAQ@isocpp.org>)
	id 1d5g0D-0000rf-CF
	for gclcip-std-proposals@m.gmane.org; Wed, 03 May 2017 00:10:37 +0200
Original-Received: by mail-wr0-f200.google.com with SMTP id g12sf15929921wrg.15
        for <gclcip-std-proposals@m.gmane.org>; Tue, 02 May 2017 15:10:43 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=message-id:date:from:user-agent:mime-version:to:subject:references
         :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=u09gvfnmDoRlOD5/mcBQwdlz19GjkeDWvyPHGBhTuro=;
        b=wldx8amFSFv4HIpwRMe9Pov04iG/KTxncv/hFMNy1rk+wmQtSR/gO1GrhYGM4VQnAZ
         r77lelbF+r8SJK1VWxrRMXhE53Blq16wB++CnoFCWWVPIHGWLq6hUPPHfbPLuJhAJGKk
         b+bt1c9WAmIrFrdEhhyjKAsHcoGXdmOyTq11LTaQOCRMKkwLopZUovpmerTIsqutq85A
         gk9cYgdDtUX97cI9DS8FeeZ707ocHBSDnDpaD+O4bdRoDa8Om/rziN5bkXH9eAne1dnr
         vVOicKXeBoWyTFbxrRPhJiGoHtzAGWQzzmmkrSaaAnTTnetKOxIcG3K4UEuNf9+itUC1
         zCjQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to
         :subject:references: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=u09gvfnmDoRlOD5/mcBQwdlz19GjkeDWvyPHGBhTuro=;
        b=sn0g0FUbP8JmXKMelOoDg72S2lERV91RoNC53MYsRguIzylJ/qZvpLGJ8h0b/6A8VV
         7qR22cEakipoNDL3niTVX9/fELu1kK+CdjCGdWQRUHYFjkU8tRNvEh7EcUZkpkAi2AZL
         1uI+W8dr2D0qqCkAqqgNbuF7vcb8iTbjACwuLiJzGjyb1NqRC7XRp+eYCcHnimM2+ZIL
         q2NMgGGHlpX9pz/6O5P9G0Xb520kejA7NdE2PUXpa7B9SHu2yejw07t8Wfr3nzOYKioL
         gRradCzLVQqTMo6hM7BfqR6woJ13Sj0l7oeU1i+7AKWyDR5DLBEy80R+7dv4A/kSKAN6
         e45Q==
X-Gm-Message-State: AN3rC/46X1WcWkCDEca+2ED1x14KGwzHA0sVQoBhaX7w+/xEGq04SFEh
	scsc4VloLvh5jQ==
X-Received: by 10.25.205.1 with SMTP id d1mr3064780lfg.11.1493763038113;
        Tue, 02 May 2017 15:10:38 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.28.63.75 with SMTP id m72ls54055wma.7.gmail; Tue, 02 May 2017
 15:10:36 -0700 (PDT)
X-Received: by 10.223.176.36 with SMTP id f33mr21784722wra.124.1493763036635;
        Tue, 02 May 2017 15:10:36 -0700 (PDT)
Original-Received: from mout.gmx.net (mout.gmx.net. [212.227.15.15])
        by mx.google.com with ESMTPS id 67si14336613wra.123.2017.05.02.15.10.35
        for <std-proposals@isocpp.org>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Tue, 02 May 2017 15:10:35 -0700 (PDT)
Received-SPF: pass (google.com: domain of jens.maurer@gmx.net designates 212.227.15.15 as permitted sender) client-ip=212.227.15.15;
Original-Received: from [192.168.2.100] ([188.101.59.151]) by mail.gmx.com (mrgmx002
 [212.227.17.190]) with ESMTPSA (Nemesis) id 0LkgEO-1dg7DS2GUG-00aTS3 for
 <std-proposals@isocpp.org>; Wed, 03 May 2017 00:10:34 +0200
In-Reply-To: <656c7e88-fcc7-7c8b-dd18-57ff30bee982@scylladb.com>
X-Provags-ID: V03:K0:hV4phanuM6C1x6EGZOGB+ialw2mpqr4cr2hplPoXzYLLcnXzX1i
 zDMidDZFucpZRb2D7W9n6nJDcuk8C2mGQ+5wTHAzwdoRByjSbSQlJoDcUL8p2jOa9JYdbLC
 cclh5q+ff7czHwcYPv6xBjcs9YHCU4cL522YZof4LEtbwtQ6NABVPS+Uz04QILH9w3gE6xt
 cX5FGQKPWIYP5h4AFnd9w==
X-UI-Out-Filterresults: notjunk:1;V01:K0:7scM0h6XaMs=:EMRjmC8eqjSfuE8J6noa6o
 AipKMTFdY4Q8bX5ZjTAiLxjvTQio9TD2USD0QgUElPCTIQxfJ7sqqYnOQlleBgii8B+4LAYPU
 KvistDJfcd/jxHxKHSZqfqpTaJbde4fwYatZ2fUFp+yGa4I1cHRz1acO0US9EZG/1i5tANIy/
 +WV2uRy+G2d63rBO+602YI3OSF1Bp3+4PAWVZTjN1xWIgoEexnuW/pjvPWy7WMUl+BJN/s9AK
 VAQbToVKXQIMvyIWntaivqivXjsZM2FIk1Uf7HD6dTyQ+uv31/FvzeXYq7uMQ8fg//Vaik1uS
 kOwciMUXAyCSMxWuqQ0xm+1Mums5AshZgDhHx52ktk1yWdbQjduLEO9YMscEbc6s93elORbT9
 TlBVWE4Z9cwabo57Uw3qtYUsg2PHfh2YD+1vfCKlA7bnEaYBUu2SSrNAzMe605yQau1nhcJor
 j3n1x+6j4KQ1wLleYsoXpqh8o7PtmjkIsy60aScOvLRdbjfqpheHG5QnvynPfrqeA7RXwydYw
 Bfg1HfiHAonDAjMKbSrRc/vnyk6G3lHNlrQati7+MJutr6Adr85RE832NZ9ivh2MDDw4/FVz8
 DypLNoUn1Y7ylTIBWCTD61onmaqn6HSnBQi4qfsvMaAcsMzkuOf9ndwCGhC4nTVjmOe6wPKq/
 4cjB8eQOrepwzPm8dgr0Wlgm6Z6K30ZD3vw9aGGO7IaGVVQn5o/VMzYbXkmydU6O6rPIncrNZ
 Te3dDZKXZ07l+jHLAgvg2IwFO/74wwDfo2keCiFVuJ7no8gHBmA0vuJUp206zi6mBlyLN8R2 
X-Original-Sender: Jens.Maurer@gmx.net
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of jens.maurer@gmx.net designates 212.227.15.15 as permitted sender) smtp.mailfrom=Jens.Maurer@gmx.net
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:32271
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/32271>

On 05/02/2017 11:33 PM, Avi Kivity wrote:
> 
> 
> On 05/02/2017 11:43 PM, Richard Smith wrote:
>> On 29 April 2017 at 14:51, Jakob Riedle <jakob.riedle@gmail.com <mailto:jakob.riedle@gmail.com>> wrote:

>>     In order to fish or cut bait w.r.t. a proposal, I'd be interested in three things:
>>     1. Are there any reasons against allowing the definition of *constexpr static class members *of the containing class type within this class itself?
>>
>>
>> Yes. The class is not yet completely defined at that point.
> 
> Yet, we allow defining functions at that point, and constexpr static variables of the same type within the function (perhaps the distinction is the "historical reasons" you mentioned above).

Consider:

struct X {
  static constexpr int n = 5;
  int a[n];                     // currently ok; useful
};

struct Y {
  Y(int n) : n(n) { }
  static constexpr Y y = 5;
  int n;
  int a[y.n];                   // does this work?
};

struct Z {
  Y(int n) : n(n) { }
  static constexpr Z z = sizeof(Z);
  int n;
  int a[z.n];                   // does this work?
};

Jens

-- 
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/590903D9.2020007%40gmx.net.

.
