220 9824 <CAOfiQq=-DRrjX2sAxpqPhhorg4ARW9q4vNA=D5k7wHzikjMiBg@mail.gmail.com> article
Path: news.gmane.org!not-for-mail
From: Richard Smith <richard@metafoo.co.uk>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: auto variable templates?
Date: Sat, 15 Mar 2014 17:17:24 -0700
Lines: 133
Approved: news@gmane.org
Message-ID: <CAOfiQq=-DRrjX2sAxpqPhhorg4ARW9q4vNA=D5k7wHzikjMiBg@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>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary=047d7b5d84ef2b25a604f4ae3a2a
X-Trace: ger.gmane.org 1394929039 5412 80.91.229.3 (16 Mar 2014 00:17:19 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Sun, 16 Mar 2014 00:17:19 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBDVNBJG4YAIBBFG3SOMQKGQEFOO3CHY@isocpp.org Sun Mar 16 01:17:27 2014
Return-path: <std-proposals+bncBDVNBJG4YAIBBFG3SOMQKGQEFOO3CHY@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-oa0-f69.google.com ([209.85.219.69])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBDVNBJG4YAIBBFG3SOMQKGQEFOO3CHY@isocpp.org>)
	id 1WOyla-00018A-9Y
	for gclcip-std-proposals@m.gmane.org; Sun, 16 Mar 2014 01:17:26 +0100
Original-Received: by mail-oa0-f69.google.com with SMTP id i7sf16545657oag.4
        for <gclcip-std-proposals@m.gmane.org>; Sat, 15 Mar 2014 17:17:25 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:mime-version:sender: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=o+ou10l35ll78GFMv0MmbFtUuO223H4kJJIRDgtlXvo=;
        b=dzcdcVY7av6pVwhde4Sq5WhmAxzVhC4kH3Pk/KsXjxrpcVf/qpFA3TmgDitMRTqQVb
         vb4tDMqFsKPhC6cOOpMzJrCp/Tk/O5bsYs4ZwynRM2R1eQK5k8XcizH8stc3Dl1KKInd
         O2LJx7Gf+KQW9UbIW5fXk7biPwhETbZIwRNAIx2PbJGOjJ9l//Ucxrpv3e+gxXu065C3
         gzbpV0J/1a7idQb8ruMlKvC3/PFCoY1+7+ioEkx4M7uiHH2zuMkTP9WRh7gj1iAEOna2
         QTW4j5n5g9qolNeg34z509QZcJzzYL975/WIQNHQBtbQl3yLvKkS7BwtFmt7wJLKFOhZ
         ZVNA==
X-Gm-Message-State: ALoCoQkTQMxacUuPot4u6it3AIV3SfzbyeK32m6aDTN5+0t1VN0DSggCvSOydO5Tfx+SJ+ANrrkd
X-Received: by 10.182.24.134 with SMTP id u6mr6253404obf.24.1394929045159;
        Sat, 15 Mar 2014 17:17:25 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.140.50.81 with SMTP id r75ls332637qga.71.gmail; Sat, 15 Mar
 2014 17:17:24 -0700 (PDT)
X-Received: by 10.58.238.35 with SMTP id vh3mr12993507vec.16.1394929044443;
        Sat, 15 Mar 2014 17:17:24 -0700 (PDT)
Original-Received: from mail-vc0-x233.google.com (mail-vc0-x233.google.com [2607:f8b0:400c:c03::233])
        by mx.google.com with ESMTPS id x7si3033860vel.0.2014.03.15.17.17.24
        for <std-proposals@isocpp.org>
        (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
        Sat, 15 Mar 2014 17:17:24 -0700 (PDT)
Received-SPF: pass (google.com: domain of metafoo@gmail.com designates 2607:f8b0:400c:c03::233 as permitted sender) client-ip=2607:f8b0:400c:c03::233;
Original-Received: by mail-vc0-f179.google.com with SMTP id ij19so4270521vcb.24
        for <std-proposals@isocpp.org>; Sat, 15 Mar 2014 17:17:24 -0700 (PDT)
X-Received: by 10.58.154.10 with SMTP id vk10mr13265394veb.18.1394929044234;
 Sat, 15 Mar 2014 17:17:24 -0700 (PDT)
Original-Sender: metafoo@gmail.com
Original-Received: by 10.58.218.131 with HTTP; Sat, 15 Mar 2014 17:17:24 -0700 (PDT)
In-Reply-To: <CANu6V4ViH09LeqDs_Vc2tivK97=6yThejGLJ6+m0dRx0Fu+vRQ@mail.gmail.com>
X-Original-Sender: richard@metafoo.co.uk
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of metafoo@gmail.com designates 2607:f8b0:400c:c03::233 as permitted
 sender) smtp.mail=metafoo@gmail.com;       dkim=pass header.i=@gmail.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:9824
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/9824>

--047d7b5d84ef2b25a604f4ae3a2a
Content-Type: text/plain; charset=ISO-8859-1

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."

-- 

--- 
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/.

--047d7b5d84ef2b25a604f4ae3a2a
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_extra"><div class=3D"gmail_quote">On S=
at, Mar 15, 2014 at 5:13 PM, Johannes Schaub <span dir=3D"ltr">&lt;<a href=
=3D"mailto:schaub.johannes@googlemail.com" target=3D"_blank">schaub.johanne=
s@googlemail.com</a>&gt;</span> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex">2014-03-16 0:38 GMT+01:00 Richard Smith &lt;=
<a href=3D"mailto:richard@metafoo.co.uk">richard@metafoo.co.uk</a>&gt;:<br>
<div class=3D"">&gt; On Sat, Mar 15, 2014 at 1:46 PM, Andrew Tomazos &lt;<a=
 href=3D"mailto:andrewtomazos@gmail.com">andrewtomazos@gmail.com</a>&gt;<br=
>
&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt; Is the following supposed to be ill-formed according to the curren=
t draft?<br>
&gt;&gt;<br>
&gt;&gt; template&lt;class&gt; constexpr auto X =3D 42;<br>
&gt;&gt;<br>
&gt;&gt; int main()<br>
&gt;&gt; {<br>
&gt;&gt; =A0 =A0 =A0 =A0 static_assert(X&lt;int&gt; =3D=3D 42, &quot;&quot;=
);<br>
&gt;&gt; }<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; [dcl.spec.auto]/4 says that auto is allowed when declaring variabl=
es in<br>
&gt;&gt; namespace-scope, but doesn&#39;t explicitly say in variable templa=
tes -<br>
&gt;&gt; consequently this is ill-formed.<br>
&gt;<br>
&gt;<br>
&gt; A specialization of a variable template is a variable, so this is allo=
wed.<br>
&gt;<br>
<br>
</div>I don&#39;t understand this reason. The following is not a specializa=
tion<br>
of a variable template, is it?<br>
<div class=3D""><br>
=A0 =A0template&lt;class&gt; constexpr auto X =3D 42;<br>
<br>
</div>The Standard says in 7.1.6.4p6, &quot;A program that uses auto or<br>
decltype(auto) in a context not explicitly allowed in this section is<br>
ill-formed.&quot;<br>
<br>
The section does not explicitly allow &quot;auto&quot; for variable templat=
es.<br>
Why does it matter that the specialization of that template is a<br>
variable?</blockquote><div><br></div><div>Because the validity of a templat=
e isn&#39;t governed by the usual language rules. 14.6/8: &quot;No diagnost=
ic shall be issued for a template for which a valid specialization can be g=
enerated.&quot;</div>
</div></div></div>

<p></p>

-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--047d7b5d84ef2b25a604f4ae3a2a--

.
