220 4686 <CAOfiQqntOQNcJqqYBmc=ajJn3s90GOL2EhnwixWsua5euCJFUg@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: Re: Changing lambda scope
Date: Tue, 28 May 2013 14:56:41 -0700
Lines: 170
Approved: news@gmane.org
Message-ID: <CAOfiQqntOQNcJqqYBmc=ajJn3s90GOL2EhnwixWsua5euCJFUg@mail.gmail.com>
References: <ae01f736-d3ac-48d6-981f-702b9ab2b3b3@isocpp.org>
	<01190eaa-6223-4d3c-a9d3-b0d850aab98e@isocpp.org>
	<CAFk2RUa61wcA=26qp-tR2QX4Y5hRE0j7AAahRKcJ38Nxph+WrQ@mail.gmail.com>
	<35af8d3d-8ed6-441c-94d0-b898711190b1@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary=089e013cc32823061604ddce57b2
X-Trace: ger.gmane.org 1369778203 8649 80.91.229.3 (28 May 2013 21:56:43 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Tue, 28 May 2013 21:56:43 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBDVNBJG4YAIBBGWQSSGQKGQEPXOU7YA@isocpp.org Tue May 28 23:56:44 2013
Return-path: <std-proposals+bncBDVNBJG4YAIBBGWQSSGQKGQEPXOU7YA@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-vc0-f199.google.com ([209.85.220.199])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBDVNBJG4YAIBBGWQSSGQKGQEPXOU7YA@isocpp.org>)
	id 1UhRsp-0007vt-So
	for gclcip-std-proposals@m.gmane.org; Tue, 28 May 2013 23:56:44 +0200
Original-Received: by mail-vc0-f199.google.com with SMTP id hf12sf10472630vcb.10
        for <gclcip-std-proposals@m.gmane.org>; Tue, 28 May 2013 14:56:43 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=x-beenthere: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:x-google-group-id:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe:content-type;
        bh=4pWvqUtBCwtHy3W6PUtJb5Jex1YyaQysNwS4XPJXUyw=;
        b=TSuk5r2p8/ZAkKkhd3SGL24UwysnN9RlyGqzwaSQK7uhlQaNF6JL2zCUwYa/w28HA1
         x7QSTUcu3946iNstqPQIXxihh7PRnxciqm2y2Ow2Ki6t3gqd1dn5+fKA4UrbP9tBcYnK
         nDyGNmjLIsVRx6U7HYNdgp1L5+UHb4aiZTHNw+50JIjeqq32Ix0VB4+echTG2CHS5Vii
         2hyw/w6BbiHupxtJ5rC+G8TaHZQm72fQfH3czCJkGiHYI9qMh+Z3ajKIO8UgGtVBOzmA
         rv+ncw6LujFqmQpsEdRy6VCFiK4+MA6LuMize4lwykLs4Tgie/kLRMU44K/b063PFLLd
         iDGg==
X-Received: by 10.224.200.202 with SMTP id ex10mr212395qab.8.1369778203016;
        Tue, 28 May 2013 14:56:43 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.49.60.231 with SMTP id k7ls3647811qer.22.gmail; Tue, 28 May
 2013 14:56:42 -0700 (PDT)
X-Received: by 10.52.163.207 with SMTP id yk15mr16145667vdb.42.1369778201969;
        Tue, 28 May 2013 14:56:41 -0700 (PDT)
Original-Received: from mail-ve0-x233.google.com (mail-ve0-x233.google.com [2607:f8b0:400c:c01::233])
        by mx.google.com with ESMTPS id sa4si19768209vdc.49.2013.05.28.14.56.41
        for <std-proposals@isocpp.org>
        (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
        Tue, 28 May 2013 14:56:41 -0700 (PDT)
Received-SPF: pass (google.com: domain of metafoo@gmail.com designates 2607:f8b0:400c:c01::233 as permitted sender) client-ip=2607:f8b0:400c:c01::233;
Original-Received: by mail-ve0-f179.google.com with SMTP id d10so4001702vea.38
        for <std-proposals@isocpp.org>; Tue, 28 May 2013 14:56:41 -0700 (PDT)
X-Received: by 10.58.45.71 with SMTP id k7mr19346972vem.0.1369778201755; Tue,
 28 May 2013 14:56:41 -0700 (PDT)
Original-Sender: metafoo@gmail.com
Original-Received: by 10.58.246.226 with HTTP; Tue, 28 May 2013 14:56:41 -0700 (PDT)
In-Reply-To: <35af8d3d-8ed6-441c-94d0-b898711190b1@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:c01::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?hl=en>,
 <mailto:std-proposals@isocpp.org>
List-Help: <http://support.google.com/a/isocpp.org/bin/topic.py?hl=en&topic=25838>,
 <mailto:std-proposals+help@isocpp.org>
List-Archive: <http://groups.google.com/a/isocpp.org/group/std-proposals/?hl=en>
List-Subscribe: <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe?hl=en>,
 <mailto:std-proposals+subscribe@isocpp.org>
List-Unsubscribe: <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe?hl=en>,
 <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:4686
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/4686>

--089e013cc32823061604ddce57b2
Content-Type: text/plain; charset=ISO-8859-1

On Mon, May 27, 2013 at 5:18 AM, <potswa@gmail.com> wrote:

>
> You can return a lambda or a local class from a lambda in C++11, so that
>> doesn't count as an excuse for noticing this now because
>> we can return local types from a non-lambda in C++14.
>>
>
> Sort of. You can return it from a lambda but you can't return it out of
> the enclosing non-lambda function scope. The only way to pass it out of the
> *namespace*, which is what matters, is to pass it into a template, which
> is what I did with my example.
>
> By the way, the language as-is seems deeply flawed. Only a singly-nested
> class has an associated namespace; nest a class inside a nested class and
> it becomes disconnected from its namespace.
>
>
>    -
>
>    If T is a class type (including unions), its associated classes are:
>    the class itself; the class of which it is a member, if any; and its direct
>    and indirect base classes. Its associated namespaces are the namespaces of
>    which its associated classes are members.
>
>
> GCC and Clang both incorrectly accept this example:
>
> namespace n {
> struct s { struct n1 { struct n2 {}; }; };
> int f( s::n1::n2 ) { return 3; }
> }
> int i = f( n::s::n1::n2() );
>

Core issue 557 appears to be responsible for this. Prior to that issue, the
wording said "Its associated namespaces are the namespaces in which its
associated classes are defined." which in this case includes 'n'.
Presumably the intent here was to clarify that a::b would be the associated
namespace for a::b::x here, not a:

namespace a {
  namespace b { struct x; }
  struct b::x {};
}

I don't know whether the change to deeply-nested member classes was
intentional. Neither gcc nor clang treats n::s as an associated class,
although both treat n as an associated namespace. EDG also treats n as an
associated namespace, but this is not definitive because it also treats
n::s as an associated class (contrary to the specification).

-- 

--- 
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/?hl=en.



--089e013cc32823061604ddce57b2
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

On Mon, May 27, 2013 at 5:18 AM,  <span dir=3D"ltr">&lt;<a href=3D"mailto:p=
otswa@gmail.com" target=3D"_blank">potswa@gmail.com</a>&gt;</span> wrote:<b=
r><div class=3D"gmail_quote"><blockquote class=3D"gmail_quote" style=3D"mar=
gin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class=3D"im"><br><blockquote class=3D"gmail_quote" style=3D"margin:0;m=
argin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"l=
tr"><div><div class=3D"gmail_quote"><div>You can return a lambda or a local=
 class from a lambda in C++11, so that doesn&#39;t count as an excuse for n=
oticing this now because<br>
we can return local types from a non-lambda in C++14.<br></div></div></div>=
</div></blockquote></div><div><br>Sort of. You can return it from a lambda =
but you can&#39;t return it out of the enclosing non-lambda function scope.=
 The only way to pass it out of the <i>namespace</i>, which is what matters=
, is to pass it into a template, which is what I did with my example.<br>
<br>By the way, the language as-is seems deeply flawed. Only a singly-neste=
d class has an associated namespace; nest a class inside a nested class and=
 it becomes disconnected from its namespace.<br><br>

=09
	=09
	=09
=09
=09
		<div title=3D"Page 62">
			<div>
				<div>
					<ul style=3D"list-style-type:none"><li>
							<p><span style=3D"font-size:10.000000pt;font-family:&#39;LMRoman10&#=
39;">If </span><span style=3D"font-size:10.000000pt;font-family:&#39;LMMono=
10&#39;">T </span><span style=3D"font-size:10.000000pt;font-family:&#39;LMR=
oman10&#39;">is a class type (including unions), its associated classes are=
: the class itself; the class of which it is a
member, if any; and its direct and indirect base classes. Its associated na=
mespaces are the namespaces
of which its associated classes are members.
</span></p>
						</li></ul>
				</div>
			</div>
		</div>
=09
<br>GCC and Clang both incorrectly accept this example:<br><br><div style=
=3D"background-color:rgb(250,250,250);border-color:rgb(187,187,187);border-=
style:solid;border-width:1px;word-wrap:break-word"><code><div><span style=
=3D"color:#008">namespace</span><span style> n </span><span style=3D"color:=
#660">{</span><span style><br>
</span><span style=3D"color:#008">struct</span><span style> s </span><span =
style=3D"color:#660">{</span><span style> </span><span style=3D"color:#008"=
>struct</span><span style> n1 </span><span style=3D"color:#660">{</span><sp=
an style> </span><span style=3D"color:#008">struct</span><span style> n2 </=
span><span style=3D"color:#660">{};</span><span style> </span><span style=
=3D"color:#660">};</span><span style> </span><span style=3D"color:#660">};<=
/span><span style><br>
</span><span style=3D"color:#008">int</span><span style> f</span><span styl=
e=3D"color:#660">(</span><span style> s</span><span style=3D"color:#660">::=
</span><span style>n1</span><span style=3D"color:#660">::</span><span style=
>n2 </span><span style=3D"color:#660">)</span><span style> </span><span sty=
le=3D"color:#660">{</span><span style> </span><span style=3D"color:#008">re=
turn</span><span style> </span><span style=3D"color:#066">3</span><span sty=
le=3D"color:#660">;</span><span style> </span><span style=3D"color:#660">}<=
/span><span style><br>
</span><span style=3D"color:#660">}</span><span style><br></span><span styl=
e=3D"color:#008">int</span><span style> i </span><span style=3D"color:#660"=
>=3D</span><span style> f</span><span style=3D"color:#660">(</span><span st=
yle> n</span><span style=3D"color:#660">::</span><span style>s</span><span =
style=3D"color:#660">::</span><span style>n1</span><span style=3D"color:#66=
0">::</span><span style>n2</span><span style=3D"color:#660">()</span><span =
style> </span><span style=3D"color:#660">);</span></div>
</code></div></div></blockquote><div><br></div><div>Core issue 557 appears =
to be responsible for this. Prior to that issue, the wording=A0said &quot;I=
ts associated namespaces are the namespaces in which its associated classes=
 are defined.&quot; which in this case includes &#39;n&#39;. Presumably the=
 intent here was to clarify that a::b would be the associated namespace for=
 a::b::x here, not a:</div>
<div><br></div><div>namespace a {</div><div>=A0 namespace b { struct x; }</=
div><div>=A0 struct b::x {};</div><div>}</div><div><br></div><div>I don&#39=
;t know whether the change to deeply-nested member classes was intentional.=
 Neither gcc nor clang treats n::s as an associated class, although both tr=
eat n as an associated namespace. EDG also treats n as an associated namesp=
ace, but this is not definitive because it also treats n::s as an associate=
d class (contrary to the specification).</div>
</div>

<p></p>

-- <br />
&nbsp;<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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/?hl=3Den">http://groups.google.com/a/isocpp.org/group/std-pro=
posals/?hl=3Den</a>.<br />
&nbsp;<br />
&nbsp;<br />

--089e013cc32823061604ddce57b2--

.
