220 9827 <CAOfiQqk6dPsD2_AAhanZUkUOew_as-9m7wsWWYVC07MOgvO4kw@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 18:07:34 -0700
Lines: 153
Approved: news@gmane.org
Message-ID: <CAOfiQqk6dPsD2_AAhanZUkUOew_as-9m7wsWWYVC07MOgvO4kw@mail.gmail.com>
References: <ec829ec4-9d4e-4d5c-8673-a58d46fec41b@isocpp.org>
	<CAOfiQqkf4N3Pga8V7n6as-CBdWWGJeKh-0s8ONxsdpRtamo-Cg@mail.gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary=001a11c2ca0c9fcc5104f4aeed98
X-Trace: ger.gmane.org 1394932049 5001 80.91.229.3 (16 Mar 2014 01:07:29 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Sun, 16 Mar 2014 01:07:29 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBDVNBJG4YAIBBV7SSOMQKGQENBJ3DQI@isocpp.org Sun Mar 16 02:07:39 2014
Return-path: <std-proposals+bncBDVNBJG4YAIBBV7SSOMQKGQENBJ3DQI@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-pa0-f72.google.com ([209.85.220.72])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBDVNBJG4YAIBBV7SSOMQKGQENBJ3DQI@isocpp.org>)
	id 1WOzY9-0003ei-Cs
	for gclcip-std-proposals@m.gmane.org; Sun, 16 Mar 2014 02:07:37 +0100
Original-Received: by mail-pa0-f72.google.com with SMTP id bj1sf10383645pad.11
        for <gclcip-std-proposals@m.gmane.org>; Sat, 15 Mar 2014 18:07:36 -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=ZJE5DiyC+WbB4CU/ncMVKcrQ5jSCSpNUzgAt6i4rHzI=;
        b=KikXKHMZ3Mi6KxnEgjEkjXWTPArh1/RVpQYWjfghReTUXddN/O7TunKQvBHQg69oZ7
         BbqIl5NpTt4CIHdqIdogr6DJzP75enxxSAAikDPZcIBXXYOD74IQYjL4Bpe8lqZHfgUM
         Tu3J/yuhSShWwU95w/IoCf32BiM35krnyNiEXpHyE7NLKR84FiTGISKPS7RDMMpFaGrQ
         EyOZNN9PBMKvmzbVXM3qcLUr6/3NnAx2OKkzPUAI+aqoEMhmI/USmTN0mr5yAXmrZPZV
         gtIKpiU167I3J3egTgxl2uJYo6Q3gM3MK15JpsOUW+M/M4h/Eo6oT2/gVWXL2702gNuh
         lCvA==
X-Gm-Message-State: ALoCoQkL+E7L73Xr5Q6S/0Ucd4A1mBobx9Bb10Fb1SbOSYElRM33FkGPh527CJIQlDwM/6ae/mPA
X-Received: by 10.66.231.132 with SMTP id tg4mr6289645pac.31.1394932056107;
        Sat, 15 Mar 2014 18:07:36 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.140.88.101 with SMTP id s92ls1197484qgd.82.gmail; Sat, 15 Mar
 2014 18:07:35 -0700 (PDT)
X-Received: by 10.52.251.199 with SMTP id zm7mr11307539vdc.21.1394932055133;
        Sat, 15 Mar 2014 18:07:35 -0700 (PDT)
Original-Received: from mail-vc0-x22d.google.com (mail-vc0-x22d.google.com [2607:f8b0:400c:c03::22d])
        by mx.google.com with ESMTPS id xb4si667942vdc.192.2014.03.15.18.07.35
        for <std-proposals@isocpp.org>
        (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
        Sat, 15 Mar 2014 18:07:35 -0700 (PDT)
Received-SPF: pass (google.com: domain of metafoo@gmail.com designates 2607:f8b0:400c:c03::22d as permitted sender) client-ip=2607:f8b0:400c:c03::22d;
Original-Received: by mail-vc0-f173.google.com with SMTP id il7so4436408vcb.32
        for <std-proposals@isocpp.org>; Sat, 15 Mar 2014 18:07:35 -0700 (PDT)
X-Received: by 10.220.159.4 with SMTP id h4mr2088202vcx.1.1394932055000; Sat,
 15 Mar 2014 18:07:35 -0700 (PDT)
Original-Sender: metafoo@gmail.com
Original-Received: by 10.58.218.131 with HTTP; Sat, 15 Mar 2014 18:07:34 -0700 (PDT)
In-Reply-To: <CAOfiQqkf4N3Pga8V7n6as-CBdWWGJeKh-0s8ONxsdpRtamo-Cg@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::22d 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:9827
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/9827>

--001a11c2ca0c9fcc5104f4aeed98
Content-Type: text/plain; charset=ISO-8859-1

On Sat, Mar 15, 2014 at 4:38 PM, Richard Smith <richard@metafoo.co.uk>wrote:

> 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.
>
>
>> Clang trunk rejects it, albeit it with an obtuse error message: "invalid
>> operands to binary expression ('auto' and 'int')"
>>
>> Was this intended?
>>
>
> Looks like a bug.
>

(Now fixed in Clang trunk.)

-- 

--- 
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/.

--001a11c2ca0c9fcc5104f4aeed98
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 4:38 PM, Richard Smith <span dir=3D"ltr">&lt;<a href=3D=
"mailto:richard@metafoo.co.uk" target=3D"_blank">richard@metafoo.co.uk</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"><div dir=3D"ltr"><div class=3D"gmail_extra">=
<div class=3D"gmail_quote"><div class=3D"">On Sat, Mar 15, 2014 at 1:46 PM,=
 Andrew Tomazos <span dir=3D"ltr">&lt;<a href=3D"mailto:andrewtomazos@gmail=
..com" target=3D"_blank">andrewtomazos@gmail.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"><div dir=3D"ltr">Is the following supposed t=
o be ill-formed according to the current draft?<div><br></div><div><pre sty=
le=3D"line-height:17.804800033569336px;max-height:600px;background:rgb(238,=
238,238);width:auto;overflow:auto;font-size:14px;margin-bottom:10px;font-fa=
mily:Consolas,Menlo,Monaco,&#39;Lucida Console&#39;,&#39;Liberation Mono&#3=
9;,&#39;DejaVu Sans Mono&#39;,&#39;Bitstream Vera Sans Mono&#39;,&#39;Couri=
er New&#39;,monospace,serif;word-wrap:normal;padding:5px">
<code style=3D"font-family:Consolas,Menlo,Monaco,&#39;Lucida Console&#39;,&=
#39;Liberation Mono&#39;,&#39;DejaVu Sans Mono&#39;,&#39;Bitstream Vera San=
s Mono&#39;,&#39;Courier New&#39;,monospace,serif;white-space:inherit;backg=
round-image:initial;background-repeat:initial"><span style=3D"color:rgb(0,0=
,139);background:transparent">template</span><span style=3D"color:rgb(128,0=
,0);background:transparent">&lt;class&gt;</span><span style=3D"background:t=
ransparent"> </span><span style=3D"color:rgb(0,0,139);background:transparen=
t">constexpr</span><span style=3D"background:transparent"> </span><span sty=
le=3D"color:rgb(0,0,139);background:transparent">auto</span><span style=3D"=
background:transparent"> X </span><span style=3D"background:transparent">=
=3D</span><span style=3D"background:transparent"> </span><span style=3D"col=
or:rgb(128,0,0);background:transparent">42</span><span style=3D"background:=
transparent">;</span><span style=3D"background:transparent">

</span><span style=3D"color:rgb(43,145,175);background:transparent">int</sp=
an><span style=3D"background:transparent"> main</span><span style=3D"backgr=
ound:transparent">()</span><span style=3D"background:transparent">
</span><span style=3D"background:transparent">{</span><span style=3D"backgr=
ound:transparent">
        </span><span style=3D"color:rgb(0,0,139);background:transparent">st=
atic_assert</span><span style=3D"background:transparent">(</span><span styl=
e=3D"background:transparent">X</span><span style=3D"color:rgb(128,0,0);back=
ground:transparent">&lt;int&gt;</span><span style=3D"background:transparent=
"> </span><span style=3D"background:transparent">=3D=3D</span><span style=
=3D"background:transparent"> </span><span style=3D"color:rgb(128,0,0);backg=
round:transparent">42</span><span style=3D"background:transparent">,</span>=
<span style=3D"background:transparent"> </span><span style=3D"color:rgb(128=
,0,0);background:transparent">&quot;&quot;</span><span style=3D"background:=
transparent">);</span><span style=3D"background:transparent">
</span><span style=3D"background:transparent">}</span></code></pre></div><d=
iv><br></div><div>[dcl.spec.auto]/4 says that auto is allowed when declarin=
g variables in namespace-scope, but doesn&#39;t explicitly say in variable =
templates - consequently this is ill-formed.</div>

</div></blockquote><div><br></div></div><div>A specialization of a variable=
 template is a variable, so this is allowed.</div><div class=3D""><div>=A0<=
/div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-le=
ft:1px #ccc solid;padding-left:1ex">

<div dir=3D"ltr"><div>Clang trunk rejects it, albeit it with an obtuse erro=
r message: &quot;<span style=3D"line-height:17.804800033569336px;background=
:transparent;font-size:14px;white-space:inherit;font-family:Consolas,Menlo,=
Monaco,&#39;Lucida Console&#39;,&#39;Liberation Mono&#39;,&#39;DejaVu Sans =
Mono&#39;,&#39;Bitstream Vera Sans Mono&#39;,&#39;Courier New&#39;,monospac=
e,serif">invalid operands to binary expression </span><span style=3D"line-h=
eight:17.804800033569336px;background:transparent;font-size:14px;white-spac=
e:inherit;font-family:Consolas,Menlo,Monaco,&#39;Lucida Console&#39;,&#39;L=
iberation Mono&#39;,&#39;DejaVu Sans Mono&#39;,&#39;Bitstream Vera Sans Mon=
o&#39;,&#39;Courier New&#39;,monospace,serif">(</span><span style=3D"font-f=
amily:Consolas,Menlo,Monaco,&#39;Lucida Console&#39;,&#39;Liberation Mono&#=
39;,&#39;DejaVu Sans Mono&#39;,&#39;Bitstream Vera Sans Mono&#39;,&#39;Cour=
ier New&#39;,monospace,serif;white-space:inherit;font-size:14px;line-height=
:17.804800033569336px;color:rgb(128,0,0);background:transparent">&#39;auto&=
#39;</span><span style=3D"line-height:17.804800033569336px;background:trans=
parent;font-size:14px;white-space:inherit;font-family:Consolas,Menlo,Monaco=
,&#39;Lucida Console&#39;,&#39;Liberation Mono&#39;,&#39;DejaVu Sans Mono&#=
39;,&#39;Bitstream Vera Sans Mono&#39;,&#39;Courier New&#39;,monospace,seri=
f"> and </span><span style=3D"font-family:Consolas,Menlo,Monaco,&#39;Lucida=
 Console&#39;,&#39;Liberation Mono&#39;,&#39;DejaVu Sans Mono&#39;,&#39;Bit=
stream Vera Sans Mono&#39;,&#39;Courier New&#39;,monospace,serif;white-spac=
e:inherit;font-size:14px;line-height:17.804800033569336px;color:rgb(128,0,0=
);background:transparent">&#39;int&#39;</span><span style=3D"line-height:17=
..804800033569336px;background:transparent;font-size:14px;white-space:inheri=
t;font-family:Consolas,Menlo,Monaco,&#39;Lucida Console&#39;,&#39;Liberatio=
n Mono&#39;,&#39;DejaVu Sans Mono&#39;,&#39;Bitstream Vera Sans Mono&#39;,&=
#39;Courier New&#39;,monospace,serif">)&quot;</span></div>

<div><br></div><div>Was this intended?</div></div></blockquote><div><br></d=
iv></div><div>Looks like a bug.</div></div></div></div>
</blockquote></div><br></div><div class=3D"gmail_extra">(Now fixed in Clang=
 trunk.)</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 />

--001a11c2ca0c9fcc5104f4aeed98--

.
