220 9822 <CAOfiQqkf4N3Pga8V7n6as-CBdWWGJeKh-0s8ONxsdpRtamo-Cg@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 16:38:44 -0700
Lines: 137
Approved: news@gmane.org
Message-ID: <CAOfiQqkf4N3Pga8V7n6as-CBdWWGJeKh-0s8ONxsdpRtamo-Cg@mail.gmail.com>
References: <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=001a11c1d71ce9ba4a04f4adaf8d
X-Trace: ger.gmane.org 1394926718 12387 80.91.229.3 (15 Mar 2014 23:38:38 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Sat, 15 Mar 2014 23:38:38 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBDVNBJG4YAIBBBOJSOMQKGQEKFC3IZQ@isocpp.org Sun Mar 16 00:38:48 2014
Return-path: <std-proposals+bncBDVNBJG4YAIBBBOJSOMQKGQEKFC3IZQ@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-qa0-f72.google.com ([209.85.216.72])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBDVNBJG4YAIBBBOJSOMQKGQEKFC3IZQ@isocpp.org>)
	id 1WOyAA-0001tN-Of
	for gclcip-std-proposals@m.gmane.org; Sun, 16 Mar 2014 00:38:47 +0100
Original-Received: by mail-qa0-f72.google.com with SMTP id f11sf8548071qae.11
        for <gclcip-std-proposals@m.gmane.org>; Sat, 15 Mar 2014 16:38:45 -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=revwD4OCHnZCw+5Y0uSJK2QW+QJeHaQeKIA2wMiWpjE=;
        b=EvTe3RAP3M2j6nUB7edHVQi5p8YHiT/ZA9D1fwhPrzFzAC7Kmfkm8rhnhMxie/j5Tw
         hz3SevSsfw1WNnXhKsIxfWLwZVES/mVtms1aDrcjEgNocIluDY91zs1vHOMde2NDEZ9N
         swWD7KY8xSbQD6YEdvpM4sbzRvdJQlOP2zq8r/FiImNk/KlKTtzOr8jYVCroRuHZgaoS
         3QLgepLP4nwAJ0duKauhiL4c3TlNx5ckdYqugTUBwt6RW4RcI8jtl66iTokTgt11OfeT
         X3j+xIsc2E6wcGJqhmu7anAjAZ7G+EJkHS8ohfaPXPWMAqND//9dv4cPvbwaOjBqP52V
         fl8g==
X-Gm-Message-State: ALoCoQk3TMQ+FuqjMQt0sjL58fzSQ3Lk+yXUW70DnzoLa06pPgtIfpGjFifffuIG/SIo5wr9dUy+
X-Received: by 10.236.96.138 with SMTP id r10mr4862602yhf.12.1394926725853;
        Sat, 15 Mar 2014 16:38:45 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.140.82.39 with SMTP id g36ls1140136qgd.25.gmail; Sat, 15 Mar
 2014 16:38:45 -0700 (PDT)
X-Received: by 10.221.29.137 with SMTP id ry9mr13089742vcb.6.1394926725013;
        Sat, 15 Mar 2014 16:38:45 -0700 (PDT)
Original-Received: from mail-vc0-x22b.google.com (mail-vc0-x22b.google.com [2607:f8b0:400c:c03::22b])
        by mx.google.com with ESMTPS id uh1si3686493vcb.100.2014.03.15.16.38.44
        for <std-proposals@isocpp.org>
        (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
        Sat, 15 Mar 2014 16:38:44 -0700 (PDT)
Received-SPF: pass (google.com: domain of metafoo@gmail.com designates 2607:f8b0:400c:c03::22b as permitted sender) client-ip=2607:f8b0:400c:c03::22b;
Original-Received: by mail-vc0-f171.google.com with SMTP id lg15so4259773vcb.2
        for <std-proposals@isocpp.org>; Sat, 15 Mar 2014 16:38:44 -0700 (PDT)
X-Received: by 10.220.99.72 with SMTP id t8mr13111358vcn.10.1394926724690;
 Sat, 15 Mar 2014 16:38:44 -0700 (PDT)
Original-Sender: metafoo@gmail.com
Original-Received: by 10.58.218.131 with HTTP; Sat, 15 Mar 2014 16:38:44 -0700 (PDT)
In-Reply-To: <ec829ec4-9d4e-4d5c-8673-a58d46fec41b@isocpp.org>
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::22b 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:9822
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/9822>

--001a11c1d71ce9ba4a04f4adaf8d
Content-Type: text/plain; charset=ISO-8859-1

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.

-- 

--- 
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/.

--001a11c1d71ce9ba4a04f4adaf8d
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 1:46 PM, Andrew Tomazos <span dir=3D"ltr">&lt;<a href=
=3D"mailto:andrewtomazos@gmail.com" target=3D"_blank">andrewtomazos@gmail.c=
om</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>A specialization of a variable templ=
ate is a variable, so this is allowed.</div><div>=A0</div><blockquote class=
=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padd=
ing-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>Looks like a bug.</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 />

--001a11c1d71ce9ba4a04f4adaf8d--

.
