220 9821 <ec829ec4-9d4e-4d5c-8673-a58d46fec41b@isocpp.org> article
Path: news.gmane.org!not-for-mail
From: Andrew Tomazos <andrewtomazos@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: auto variable templates?
Date: Sat, 15 Mar 2014 13:46:21 -0700 (PDT)
Lines: 132
Approved: news@gmane.org
Message-ID: <ec829ec4-9d4e-4d5c-8673-a58d46fec41b@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; 
	boundary="----=_Part_275_17891816.1394916381800"
X-Trace: ger.gmane.org 1394916377 8305 80.91.229.3 (15 Mar 2014 20:46:17 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Sat, 15 Mar 2014 20:46:17 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBD5KHQXXWYPRBHXYSKMQKGQE62BGQ7Q@isocpp.org Sat Mar 15 21:46:27 2014
Return-path: <std-proposals+bncBD5KHQXXWYPRBHXYSKMQKGQE62BGQ7Q@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-ve0-f198.google.com ([209.85.128.198])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBD5KHQXXWYPRBHXYSKMQKGQE62BGQ7Q@isocpp.org>)
	id 1WOvTM-0004wZ-R3
	for gclcip-std-proposals@m.gmane.org; Sat, 15 Mar 2014 21:46:25 +0100
Original-Received: by mail-ve0-f198.google.com with SMTP id oz11sf9554983veb.9
        for <gclcip-std-proposals@m.gmane.org>; Sat, 15 Mar 2014 13:46:23 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=date:from:to:message-id:subject:mime-version:x-original-sender
         :reply-to:precedence:mailing-list:list-id:list-post:list-help
         :list-archive:list-subscribe:list-unsubscribe:content-type;
        bh=XA9kUUD4EShM1yr2ROrhUu21dRI8j1f1p1areA0qVqo=;
        b=l6wpLhaaaMRzEpObZtqFZKfnXywjkNEHV6sBSi8d7gEunwiRXpoUxRxvppH820yt1l
         cqMoVacflPqd7p5abiF8CZpBCps6wCPYoVfsgnU/CCDuHsnHBwJOxcv80PSQHzMLwd6F
         Kkt4XyMzx/z4BqFWk0ddNU3DbS5l8DPhMwQLmcjnBrqjHwXbZg/Y/sHR82/dKWcwqg0M
         2S6gTAZbUlVaF26ctZlDn5xZrzX3Nv0RkIdxTMsUVLZ/ZCPkVZzNasRzVzfEZEzLU9+7
         IBqh/eSDe5WrvEJl9Ie8+NPBxTgi9jZk0VKw8npIOADC/PMW35W2g3sZ7elVYOC/hQl/
         dNgA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:date:from:to:message-id:subject:mime-version
         :x-original-sender:reply-to:precedence:mailing-list:list-id
         :list-post:list-help:list-archive:list-subscribe:list-unsubscribe
         :content-type;
        bh=XA9kUUD4EShM1yr2ROrhUu21dRI8j1f1p1areA0qVqo=;
        b=ONjNz3RE/WETnvq4AtbQhF32DEirdg6rJ9Hc3gFdA5IjGB6PFsRTZ+iVR+RecW3VCE
         ig5fWyRGM0qMfhXYI06yACJ/bik+Ui28hoTaoQknxNIpVLegsXJfZS0xH6h3kdXcTKMT
         YJh+Cg3QOoEEZvK2FMyLkVdKZthKrsjImoDqMCuy4HD5vPJKxKpXGYKaPFUBucnZAnPD
         2Xd7ma9WIaY1dZ4Oa4+xnrbPzzhXtR0UESWiX6e2wOD1zkxCyna0zy6C03vqr12VxAgC
         dVcui8MvOeIQ4cCEdeAxIF95T3VFCOTLMpXgr8iENWlQsmb6Of66QUGG+8JWiZmMeVsK
         TKvQ==
X-Gm-Message-State: ALoCoQmztD19z1abA/e7M2XToO+a5uraWrildoJCvds6GQFZO8XHvsyXZBIYvlkMZdgtkh9EqST6
X-Received: by 10.236.125.6 with SMTP id y6mr5523526yhh.3.1394916383415;
        Sat, 15 Mar 2014 13:46:23 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.140.107.7 with SMTP id g7ls1197466qgf.53.gmail; Sat, 15 Mar
 2014 13:46:22 -0700 (PDT)
X-Received: by 10.140.108.6 with SMTP id i6mr293568qgf.0.1394916382563;
        Sat, 15 Mar 2014 13:46:22 -0700 (PDT)
X-Original-Sender: andrewtomazos@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:9821
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/9821>

------=_Part_275_17891816.1394916381800
Content-Type: text/plain; charset=UTF-8

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.

Clang trunk rejects it, albeit it with an obtuse error message: "invalid 
operands to binary expression ('auto' and 'int')"

Was this intended?

If so, what was the problem with having them?  auto variable templates 
would be very useful.

-- 

--- 
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/.

------=_Part_275_17891816.1394916381800
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Is the following supposed to be ill-formed according to th=
e current draft?<div><br></div><div><pre class=3D"lang-cpp prettyprint pret=
typrinted" style=3D"margin-bottom: 10px; padding: 5px; font-size: 14px; fon=
t-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'De=
jaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, seri=
f; overflow: auto; width: auto; max-height: 600px; word-wrap: normal; color=
: rgb(0, 0, 0); line-height: 17.804800033569336px; background: rgb(238, 238=
, 238);"><code style=3D"font-family: Consolas, Menlo, Monaco, 'Lucida Conso=
le', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Co=
urier New', monospace, serif; white-space: inherit; background-image: initi=
al; background-attachment: initial; background-size: initial; background-or=
igin: initial; background-clip: initial; background-position: initial; back=
ground-repeat: initial;"><span class=3D"kwd" style=3D"color: rgb(0, 0, 139)=
; background: transparent;">template</span><span class=3D"str" style=3D"col=
or: rgb(128, 0, 0); background: transparent;">&lt;class&gt;</span><span cla=
ss=3D"pln" style=3D"background: transparent;"> </span><span class=3D"kwd" s=
tyle=3D"color: rgb(0, 0, 139); background: transparent;">constexpr</span><s=
pan class=3D"pln" style=3D"background: transparent;"> </span><span class=3D=
"kwd" style=3D"color: rgb(0, 0, 139); background: transparent;">auto</span>=
<span class=3D"pln" style=3D"background: transparent;"> X </span><span clas=
s=3D"pun" style=3D"background: transparent;">=3D</span><span class=3D"pln" =
style=3D"background: transparent;"> </span><span class=3D"lit" style=3D"col=
or: rgb(128, 0, 0); background: transparent;">42</span><span class=3D"pun" =
style=3D"background: transparent;">;</span><span class=3D"pln" style=3D"bac=
kground: transparent;">

</span><span class=3D"typ" style=3D"color: rgb(43, 145, 175); background: t=
ransparent;">int</span><span class=3D"pln" style=3D"background: transparent=
;"> main</span><span class=3D"pun" style=3D"background: transparent;">()</s=
pan><span class=3D"pln" style=3D"background: transparent;">
</span><span class=3D"pun" style=3D"background: transparent;">{</span><span=
 class=3D"pln" style=3D"background: transparent;">
        </span><span class=3D"kwd" style=3D"color: rgb(0, 0, 139); backgrou=
nd: transparent;">static_assert</span><span class=3D"pun" style=3D"backgrou=
nd: transparent;">(</span><span class=3D"pln" style=3D"background: transpar=
ent;">X</span><span class=3D"str" style=3D"color: rgb(128, 0, 0); backgroun=
d: transparent;">&lt;int&gt;</span><span class=3D"pln" style=3D"background:=
 transparent;"> </span><span class=3D"pun" style=3D"background: transparent=
;">=3D=3D</span><span class=3D"pln" style=3D"background: transparent;"> </s=
pan><span class=3D"lit" style=3D"color: rgb(128, 0, 0); background: transpa=
rent;">42</span><span class=3D"pun" style=3D"background: transparent;">,</s=
pan><span class=3D"pln" style=3D"background: transparent;"> </span><span cl=
ass=3D"str" style=3D"color: rgb(128, 0, 0); background: transparent;">""</s=
pan><span class=3D"pun" style=3D"background: transparent;">);</span><span c=
lass=3D"pln" style=3D"background: transparent;">
</span><span class=3D"pun" style=3D"background: transparent;">}</span></cod=
e></pre></div><div><br></div><div>[dcl.spec.auto]/4 says that auto is allow=
ed when declaring variables in namespace-scope, but doesn't explicitly say =
in variable templates - consequently this is ill-formed.</div><div><br></di=
v><div>Clang trunk rejects it, albeit it with an obtuse error message: "<sp=
an class=3D"pln" style=3D"font-family: Consolas, Menlo, Monaco, 'Lucida Con=
sole', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', '=
Courier New', monospace, serif; white-space: inherit; color: rgb(0, 0, 0); =
font-size: 14px; line-height: 17.804800033569336px; background: transparent=
;">invalid operands to binary expression </span><span class=3D"pun" style=
=3D"font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mon=
o', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospac=
e, serif; white-space: inherit; color: rgb(0, 0, 0); font-size: 14px; line-=
height: 17.804800033569336px; background: transparent;">(</span><span class=
=3D"str" style=3D"font-family: Consolas, Menlo, Monaco, 'Lucida Console', '=
Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier =
New', monospace, serif; white-space: inherit; font-size: 14px; line-height:=
 17.804800033569336px; color: rgb(128, 0, 0); background: transparent;">'au=
to'</span><span class=3D"pln" style=3D"font-family: Consolas, Menlo, Monaco=
, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera =
Sans Mono', 'Courier New', monospace, serif; white-space: inherit; color: r=
gb(0, 0, 0); font-size: 14px; line-height: 17.804800033569336px; background=
: transparent;"> and </span><span class=3D"str" style=3D"font-family: Conso=
las, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono'=
, 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; white-space:=
 inherit; font-size: 14px; line-height: 17.804800033569336px; color: rgb(12=
8, 0, 0); background: transparent;">'int'</span><span class=3D"pun" style=
=3D"font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mon=
o', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospac=
e, serif; white-space: inherit; color: rgb(0, 0, 0); font-size: 14px; line-=
height: 17.804800033569336px; background: transparent;">)"</span></div><div=
><br></div><div>Was this intended?</div><div><br></div><div>If so, what was=
 the problem with having them? &nbsp;auto variable templates would be very =
useful.</div><div><br></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 />

------=_Part_275_17891816.1394916381800--

.
