220 16286 <e33b4000-bcf7-4040-952e-b0a5e81edd60@isocpp.org> article
Path: news.gmane.org!not-for-mail
From: Jean-Marc Bourguet <jm.bourguet@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Pointers to members of unknown class
Date: Mon, 16 Feb 2015 07:58:17 -0800 (PST)
Lines: 141
Approved: news@gmane.org
Message-ID: <e33b4000-bcf7-4040-952e-b0a5e81edd60@isocpp.org>
References: <9b03a820-0ac5-4931-9825-b2fc9ef893f9@isocpp.org>
 <885c1fbd-8701-4f70-b7ad-89ee9104f42d@isocpp.org>
 <b9e49990-712d-412e-9789-6aa83f22c0de@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_593_1451923908.1424102297524"
X-Trace: ger.gmane.org 1424102305 21391 80.91.229.3 (16 Feb 2015 15:58:25 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Mon, 16 Feb 2015 15:58:25 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBC56XVMTUYPRBGNHRCTQKGQEAUKDIFQ@isocpp.org Mon Feb 16 16:58:25 2015
Return-path: <std-proposals+bncBC56XVMTUYPRBGNHRCTQKGQEAUKDIFQ@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-yh0-f71.google.com ([209.85.213.71])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBC56XVMTUYPRBGNHRCTQKGQEAUKDIFQ@isocpp.org>)
	id 1YNO40-0005O3-Du
	for gclcip-std-proposals@m.gmane.org; Mon, 16 Feb 2015 16:58:24 +0100
Original-Received: by mail-yh0-f71.google.com with SMTP id b6sf126104816yha.2
        for <gclcip-std-proposals@m.gmane.org>; Mon, 16 Feb 2015 07:58:18 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=date:from:to:message-id:in-reply-to:references:subject:mime-version
         :content-type:x-original-sender:reply-to:precedence:mailing-list
         :list-id:list-post:list-help:list-archive:list-subscribe
         :list-unsubscribe;
        bh=eq4uFQ4PgGMiEEhUtKykaGePNyV5RxFmkU+m448vJ9c=;
        b=wPbT9id6W3wfr7mTwk6R/MpH+pbKEDcQl4xBi6/jwbViOCgoRZuOGEYChvAnOv8/Zu
         1qbFifSFzb11ln3fMn3Sw3t5lew2F8gk4IKf8EuHQmUK/GZ4+wSnoF2qOV43dSVcqwqN
         GvAYk9CIbzMS2EzR59xmn/ZZ6o8CO3jUuLcnEq2tL4cYkgkoVOz4K2RpibXs0djxjDNK
         U5vwr0NRZ4Wdrx8yV4F7Nv89/7FerPHpScAUA8aWTLofC5gvtIwScEBkenA2saRseGIj
         J/l3MK1BsrVvDHLdsq0gMNWeM1k814CvQSTiM8xboFFBcBqx6GXeOinWW+2XnYIHvB9b
         we+Q==
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:in-reply-to:references
         :subject:mime-version:content-type:x-original-sender:reply-to
         :precedence:mailing-list:list-id:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=eq4uFQ4PgGMiEEhUtKykaGePNyV5RxFmkU+m448vJ9c=;
        b=bMNfv3OsSCIlrJ9upIWy5RP99lVos75bHP8unkiieLmATn8MzofGwEoS4dC2MybLn1
         4GTTLwCN4QjuUqqyEmTbPtIsaYoJvsEYT18y9242+Qp0p8Yi7fcC+iiSdSMFip1+kFzx
         Lo2YyClcC+mii3BlvO/ZlFzd/rMz/Rkrr0SEnuG7uoMbRmAjyEXxmYHlWX/SYT2ew4Hi
         CiK08OeXIIMAJx+4EM2rjcmZFwkYoZH1DcjxTkAg5NE0lqXYUGluuxNBeEuzCThPncRw
         rHeds2p9Zrg9fwhZI83n636UUiZjZD57sE9lWlbQnK+pCRW/YRN+xQ8QyL4Q3cyOog5T
         5dXQ==
X-Gm-Message-State: ALoCoQmyASizyJMDsddtrQMpWYiizC/AncXMiyM5oYggnRI4TEqJiF9az1ivQMTR5FMnARL0G25X
X-Received: by 10.182.142.102 with SMTP id rv6mr5067997obb.47.1424102298500;
        Mon, 16 Feb 2015 07:58:18 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.140.91.2 with SMTP id y2ls2561554qgd.53.gmail; Mon, 16 Feb
 2015 07:58:17 -0800 (PST)
X-Received: by 10.140.34.56 with SMTP id k53mr233337qgk.19.1424102297821;
        Mon, 16 Feb 2015 07:58:17 -0800 (PST)
In-Reply-To: <b9e49990-712d-412e-9789-6aa83f22c0de@isocpp.org>
X-Original-Sender: JM.Bourguet@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: <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>,
 <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:16286
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/16286>

------=_Part_593_1451923908.1424102297524
Content-Type: multipart/alternative; 
	boundary="----=_Part_594_628440895.1424102297524"

------=_Part_594_628440895.1424102297524
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

Le lundi 16 f=C3=A9vrier 2015 15:58:57 UTC+1, Scott Prager a =C3=A9crit :
>
>
>
> On Monday, February 16, 2015 at 5:58:52 AM UTC-5, Markus Grech wrote:
>>
>> I have updated the proposal, feedback would be very appreciated.
>>
>> https://docs.google.com/document/d/1B4zWiym1twufigKA4RSXYR5xU4g32EJ8XNl_=
bzFtX08/edit?usp=3Dsharing
>>
>
> One possible use-case that I don't see in this proposal:
>
> struct X { int mem; };
> struct Y { int mem; };
>
>
> int void::* p =3D X::mem;
> auto xp =3D static_cast<int X::*>(p);  // (1)
> auto yp =3D static_cast<int Y::*>(p);  // (2)
>
>
> Obviously, *(1) *should be valid, and you describe such a round trip in=
=20
> the proposal, but what about *(2)*?
> Certainly not valid, but I don't see anything prohibiting it.
>

As usual, if there is nothing which give it a meaning, it is undefined. And=
=20
UB -- explicit or just by lack of
definition -- looks like the only reasonable thing in general.

In the presented case X and Y are layout-compatible, there is an obvious=20
meaning which we may want
to mandate.

--=20
Jean-Marc

--=20

---=20
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 e=
mail 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-proposa=
ls/.

------=_Part_594_628440895.1424102297524
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Le lundi 16 f=C3=A9vrier 2015 15:58:57 UTC+1, Scott Prager=
 a =C3=A9crit&nbsp;:<blockquote class=3D"gmail_quote" style=3D"margin: 0;ma=
rgin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=
=3D"ltr"><br><br>On Monday, February 16, 2015 at 5:58:52 AM UTC-5, Markus G=
rech wrote:<blockquote class=3D"gmail_quote" style=3D"margin:0;margin-left:=
0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><font c=
olor=3D"#000000" face=3D"Arial"><span style=3D"font-size:15px;white-space:p=
re-wrap">I have updated the proposal, feedback would be very appreciated.</=
span></font><div><a href=3D"https://docs.google.com/document/d/1B4zWiym1twu=
figKA4RSXYR5xU4g32EJ8XNl_bzFtX08/edit?usp=3Dsharing" rel=3D"nofollow" targe=
t=3D"_blank" onmousedown=3D"this.href=3D'https://docs.google.com/document/d=
/1B4zWiym1twufigKA4RSXYR5xU4g32EJ8XNl_bzFtX08/edit?usp\75sharing';return tr=
ue;" onclick=3D"this.href=3D'https://docs.google.com/document/d/1B4zWiym1tw=
ufigKA4RSXYR5xU4g32EJ8XNl_bzFtX08/edit?usp\75sharing';return true;">https:/=
/docs.google.com/<wbr>document/d/<wbr>1B4zWiym1twufigKA4RSXYR5xU4g32<wbr>EJ=
8XNl_bzFtX08/edit?usp=3D<wbr>sharing</a></div></div></blockquote><div><br><=
/div><div>One possible use-case that I don't see in this proposal:</div><di=
v><br></div><div style=3D"border:1px solid rgb(187,187,187);word-wrap:break=
-word;background-color:rgb(250,250,250)"><code><div><span style=3D"color:#0=
08">struct</span><span style=3D"color:#000"> X </span><span style=3D"color:=
#660">{</span><span style=3D"color:#000"> </span><span style=3D"color:#008"=
>int</span><span style=3D"color:#000"> mem</span><span style=3D"color:#660"=
>;</span><span style=3D"color:#000"> </span><span style=3D"color:#660">};</=
span><span style=3D"color:#000"><br></span><span style=3D"color:#008">struc=
t</span><span style=3D"color:#000"> Y </span><span style=3D"color:#660">{</=
span><span style=3D"color:#000"> </span><span style=3D"color:#008">int</spa=
n><span style=3D"color:#000"> mem</span><span style=3D"color:#660">;</span>=
<span style=3D"color:#000"> </span><span style=3D"color:#660">};</span><spa=
n style=3D"color:#000"><br><br><br></span><span style=3D"color:#008">int</s=
pan><span style=3D"color:#000"> </span><span style=3D"color:#008">void</spa=
n><span style=3D"color:#660">::*</span><span style=3D"color:#000"> p </span=
><span style=3D"color:#660">=3D</span><span style=3D"color:#000"> X</span><=
span style=3D"color:#660">::</span><span style=3D"color:#000">mem</span><sp=
an style=3D"color:#660">;</span><span style=3D"color:#000"><br></span><span=
 style=3D"color:#008">auto</span><span style=3D"color:#000"> xp </span><spa=
n style=3D"color:#660">=3D</span><span style=3D"color:#000"> </span><span s=
tyle=3D"color:#008">static_cast</span><span style=3D"color:#660">&lt;</span=
><span style=3D"color:#008">int</span><span style=3D"color:#000"> X</span><=
span style=3D"color:#660">::*&gt;(</span><span style=3D"color:#000">p</span=
><span style=3D"color:#660">);</span><span style=3D"color:#000"> &nbsp;</sp=
an><span style=3D"color:#800">// (1)</span><span style=3D"color:#000"><br><=
/span><span style=3D"color:#008">auto</span><span style=3D"color:#000"> yp =
</span><span style=3D"color:#660">=3D</span><span style=3D"color:#000"> </s=
pan><span style=3D"color:#008">static_cast</span><span style=3D"color:#660"=
>&lt;</span><span style=3D"color:#008">int</span><span style=3D"color:#000"=
> Y</span><span style=3D"color:#660">::*&gt;(</span><span style=3D"color:#0=
00">p</span><span style=3D"color:#660">);</span><span style=3D"color:#000">=
 &nbsp;</span><span style=3D"color:#800">// (2)</span></div></code></div><d=
iv><br></div><div><br></div><div>Obviously, <i>(1) </i>should be valid, and=
 you describe such a round trip in the proposal, but what about <i>(2)</i>?=
</div><div>Certainly not valid, but I don't see anything prohibiting it.</d=
iv></div></blockquote><div><br></div><div>As usual, if there is nothing whi=
ch give it a meaning, it is undefined. And UB -- explicit or just by lack o=
f</div><div>definition -- looks like the only reasonable thing in general.<=
/div><div><br></div><div>In the presented case X and Y are layout-compatibl=
e, there is an obvious meaning which we may want</div><div>to mandate.</div=
><div><br></div><div>--&nbsp;</div><div>Jean-Marc</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_594_628440895.1424102297524--
------=_Part_593_1451923908.1424102297524--

.
