220 9826 <CANu6V4X36vs+s5f3A_rQoKSyKuGBZtiJNkK44oVNWod=Z-jdMw@mail.gmail.com> article
Path: news.gmane.org!not-for-mail
From: Johannes Schaub <schaub.johannes@googlemail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: auto variable templates?
Date: Sun, 16 Mar 2014 01:53:52 +0100
Lines: 72
Approved: news@gmane.org
Message-ID: <CANu6V4X36vs+s5f3A_rQoKSyKuGBZtiJNkK44oVNWod=Z-jdMw@mail.gmail.com>
References: <ec829ec4-9d4e-4d5c-8673-a58d46fec41b@isocpp.org>
	<CAOfiQqkf4N3Pga8V7n6as-CBdWWGJeKh-0s8ONxsdpRtamo-Cg@mail.gmail.com>
	<CANu6V4ViH09LeqDs_Vc2tivK97=6yThejGLJ6+m0dRx0Fu+vRQ@mail.gmail.com>
	<CAOfiQq=-DRrjX2sAxpqPhhorg4ARW9q4vNA=D5k7wHzikjMiBg@mail.gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
X-Trace: ger.gmane.org 1394931224 29276 80.91.229.3 (16 Mar 2014 00:53:44 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Sun, 16 Mar 2014 00:53:44 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCQPNCEZSQNBBIPMSOMQKGQE2C3ZCPI@isocpp.org Sun Mar 16 01:53:55 2014
Return-path: <std-proposals+bncBCQPNCEZSQNBBIPMSOMQKGQE2C3ZCPI@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-yk0-f198.google.com ([209.85.160.198])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCQPNCEZSQNBBIPMSOMQKGQE2C3ZCPI@isocpp.org>)
	id 1WOzKs-0000Gp-G6
	for gclcip-std-proposals@m.gmane.org; Sun, 16 Mar 2014 01:53:54 +0100
Original-Received: by mail-yk0-f198.google.com with SMTP id 9sf22093406ykp.1
        for <gclcip-std-proposals@m.gmane.org>; Sat, 15 Mar 2014 17:53:53 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=googlemail.com; s=20120113;
        h=mime-version:in-reply-to:references:date:message-id:subject:from:to
         :x-original-sender:x-original-authentication-results:reply-to
         :precedence:mailing-list:list-id:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe:content-type;
        bh=FYem80+qasudxbARQDBMb6jA6j3+jqOIzL9zxE2Fgxg=;
        b=lZFLyNyWBnidLrsG58E8+igcN5C3zcwfKftp1T+vFhZ8W/UOJ24R5Qd+5mIDEx4gm/
         NSeqB6M9En12dGknUqF5BwN5cFAwp4W1H/jR+S0j4+TsoqvyVPpSGRu46iueYUrrS7aY
         EyR6R5llxj2dvMKOgDr0Zifu/ZiCOrpfxVhCAtaAZjJpnTlWFgqGyHKBEKIIdOeBFSMV
         lT4hXYQSCtnqLasb3rQLsUuElaSYC/1QraIfvnVAhjzfpYVQ8r/4KvQwrVXaf6lHRxvE
         CCoUHWSoytIOYVzJq0TrWqRkxfKOCKQgepKemaEhVUV/z7VwRRKyFOkGJPoi8jtgiR8k
         BR7Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:mime-version:in-reply-to:references:date
         :message-id:subject:from:to:x-original-sender
         :x-original-authentication-results:reply-to:precedence:mailing-list
         :list-id:list-post:list-help:list-archive:list-subscribe
         :list-unsubscribe:content-type;
        bh=FYem80+qasudxbARQDBMb6jA6j3+jqOIzL9zxE2Fgxg=;
        b=ieag3PMlyA32iKPmQ+bMdHWlwKkZfo7HFR1ZRZTTtDl308r4wbIfIlGkH9h9ExTG+H
         oQ418BvjBpNgmnfq3JMeiXbuvznzqa/+fKXwCyDsx+ZhAEJdkVk9Pjypkg98YkLWofVQ
         XSItrXSHXPVMxSomMANBUbrewsaEfpRQybtfzzXVzWEnf5ZhwHI9eMigtIadW/7iy7bP
         6D0eYTgSchV0WQTmnoQo18g6+5pSYoBk0LAXj4705G3uGBTncQshsUztG5QM5b7+3vMl
         lwdB3bEnLMK2Qr5gJ2woHYIBpkFbuXC/OzaKrgclCAn/YTTnZ/xpcx6PNymxLuArY1sz
         GbNg==
X-Gm-Message-State: ALoCoQkl9i/1viZHhP5xdrhUXU+bNawPoM3ZyZFGSQ/Q1Er470drFz5mLKd93r/LIQ1LtEP7jgMK
X-Received: by 10.224.167.8 with SMTP id o8mr6243079qay.0.1394931233666;
        Sat, 15 Mar 2014 17:53:53 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.50.138.131 with SMTP id qq3ls434527igb.37.canary; Sat, 15 Mar
 2014 17:53:52 -0700 (PDT)
X-Received: by 10.66.122.201 with SMTP id lu9mr17405223pab.40.1394931232749;
        Sat, 15 Mar 2014 17:53:52 -0700 (PDT)
Original-Received: from mail-pb0-x234.google.com (mail-pb0-x234.google.com [2607:f8b0:400e:c01::234])
        by mx.google.com with ESMTPS id dp3si3743778pbb.48.2014.03.15.17.53.52
        for <std-proposals@isocpp.org>
        (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
        Sat, 15 Mar 2014 17:53:52 -0700 (PDT)
Received-SPF: pass (google.com: domain of schaub.johannes@googlemail.com designates 2607:f8b0:400e:c01::234 as permitted sender) client-ip=2607:f8b0:400e:c01::234;
Original-Received: by mail-pb0-f52.google.com with SMTP id rr13so4201915pbb.39
        for <std-proposals@isocpp.org>; Sat, 15 Mar 2014 17:53:52 -0700 (PDT)
X-Received: by 10.68.7.66 with SMTP id h2mr17317786pba.91.1394931232610; Sat,
 15 Mar 2014 17:53:52 -0700 (PDT)
Original-Received: by 10.68.216.97 with HTTP; Sat, 15 Mar 2014 17:53:52 -0700 (PDT)
In-Reply-To: <CAOfiQq=-DRrjX2sAxpqPhhorg4ARW9q4vNA=D5k7wHzikjMiBg@mail.gmail.com>
X-Original-Sender: schaub.johannes@googlemail.com
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of schaub.johannes@googlemail.com designates 2607:f8b0:400e:c01::234
 as permitted sender) smtp.mail=schaub.johannes@googlemail.com;
       dkim=pass header.i=@googlemail.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: <http://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <http://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <http://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:std-proposals+subscribe@isocpp.org>
List-Unsubscribe: <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:9826
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/9826>

2014-03-16 1:17 GMT+01:00 Richard Smith <richard@metafoo.co.uk>:
> On Sat, Mar 15, 2014 at 5:13 PM, Johannes Schaub
> <schaub.johannes@googlemail.com> wrote:
>>
>> 2014-03-16 0:38 GMT+01:00 Richard Smith <richard@metafoo.co.uk>:
>> > On Sat, Mar 15, 2014 at 1:46 PM, Andrew Tomazos
>> > <andrewtomazos@gmail.com>
>> > wrote:
>> >>
>> >> Is the following supposed to be ill-formed according to the current
>> >> draft?
>> >>
>> >> template<class> constexpr auto X = 42;
>> >>
>> >> int main()
>> >> {
>> >>         static_assert(X<int> == 42, "");
>> >> }
>> >>
>> >>
>> >> [dcl.spec.auto]/4 says that auto is allowed when declaring variables in
>> >> namespace-scope, but doesn't explicitly say in variable templates -
>> >> consequently this is ill-formed.
>> >
>> >
>> > A specialization of a variable template is a variable, so this is
>> > allowed.
>> >
>>
>> I don't understand this reason. The following is not a specialization
>> of a variable template, is it?
>>
>>    template<class> constexpr auto X = 42;
>>
>> The Standard says in 7.1.6.4p6, "A program that uses auto or
>> decltype(auto) in a context not explicitly allowed in this section is
>> ill-formed."
>>
>> The section does not explicitly allow "auto" for variable templates.
>> Why does it matter that the specialization of that template is a
>> variable?
>
>
> Because the validity of a template isn't governed by the usual language
> rules. 14.6/8: "No diagnostic shall be issued for a template for which a
> valid specialization can be generated."
>

It's also not clear to me where to draw the line. Consider

class Y {
  typedef int type;
};

template<Y::type N>
struct X { };

The specialization of this template does not have template parameters,
since it's a normal class. A diangostic should therefor not be
generated for the class template, since the specialization is valid.
However, clang complains

"main.cpp:5:13: error: 'type' is a private member of 'Y'"

-- 

--- 
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

.
