Topic: Proposal for ref-qualifying the implicitly
Author: "'Matt Calabrese' via ISO C++ Standard - Future Proposals" <std-proposals@isocpp.org>
Date: Mon, 26 Mar 2018 01:43:30 +0000
Raw View
--94eb2c05e33c4e77f6056846e7b4
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
On Sun, Mar 25, 2018, 21:23 Jon Kalb <jon@kalbweb.com> wrote:
>
>
> Greetings,
>
>
>
> I=E2=80=99m working on a proposal to make the implicitly generated assign=
ment
> declarations be ref-qualified so that they only work on lvalue objects.
>
Hi Jon,
This was considered for C++11 but wasn't accepted, though it was before my
time in the committee and I have not investigated the exact reasons for why
it did not succeed. It may have simply been because it was breaking... howe=
ver,
the committee seems to be more willing to make such breaking changes now
and so a proposal is definitely worth it. I recommend investigating exactly
why C++11 did not go this route and include that in the paper along with
why we should reconsider it now. One of the pre-c++11 papers that you may
wish to check out is http://wg21.link/n2819 which proposed adding such
ref-qualified operators to the standard library. It's probably worth
getting in touch directly with those who were pushing for it in C++11.
-- Matt Calabrese
>
--=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.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/CANh8DE%3DHX4obELdYGU8R6HOEQagbySYXyWqSpvKTWj7nh=
dnK2g%40mail.gmail.com.
--94eb2c05e33c4e77f6056846e7b4
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"auto"><div><br></div><div dir=3D"auto">On Sun, Mar 25, 2018, 21=
:23 Jon Kalb <<a href=3D"mailto:jon@kalbweb.com" target=3D"_blank" rel=
=3D"noreferrer">jon@kalbweb.com</a>> wrote:<br></div><div dir=3D"auto"><=
div class=3D"gmail_quote" dir=3D"auto"><blockquote class=3D"gmail_quote" st=
yle=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div =
bgcolor=3D"white" lang=3D"EN-US" link=3D"#0563C1" vlink=3D"#954F72"><div cl=
ass=3D"m_1946895474463020231m_-6789421753381258182WordSection1"><p class=3D=
"MsoNormal"><span style=3D"font-size:11.0pt"><u></u>=C2=A0<u></u></span></p=
><p class=3D"MsoNormal"><span style=3D"font-size:11.0pt">Greetings,<u></u><=
u></u></span></p><p class=3D"MsoNormal"><span style=3D"font-size:11.0pt"><u=
></u>=C2=A0<u></u></span></p><p class=3D"MsoNormal"><span style=3D"font-siz=
e:11.0pt">I=E2=80=99m working on a proposal to make the implicitly generate=
d assignment declarations be ref-qualified so that they only work on lvalue=
objects.</span></p></div></div></blockquote></div></div><div dir=3D"auto">=
<br></div><div dir=3D"auto"><span style=3D"font-family:sans-serif">Hi Jon,<=
/span><br></div><div dir=3D"auto"><span style=3D"font-family:sans-serif"><b=
r></span></div><div dir=3D"auto"><span style=3D"font-family:sans-serif">Thi=
s was considered for C++11 but wasn't accepted, though it was before my=
time in the committee and I have not investigated the exact reasons for wh=
y it did not succeed. It may have simply been because it was breaking...</s=
pan><span style=3D"font-family:sans-serif">=C2=A0however, the committee see=
ms to be more willing to make such breaking changes now and so a proposal i=
s definitely worth it. I recommend investigating exactly why C++11 did not =
go this route and include that in the paper along with why we should recons=
ider it now. One of the pre-c++11 papers that you may wish to check out is =
<a href=3D"http://wg21.link/">http://wg21.link/</a></span><span style=3D"fo=
nt-family:sans-serif">n2819 which proposed adding such ref-qualified operat=
ors to the standard library. It's probably worth getting in touch direc=
tly with those who were pushing for it in C++11.</span></div><div dir=3D"au=
to"><span style=3D"font-family:sans-serif"><br></span></div><div dir=3D"aut=
o"><span style=3D"font-family:sans-serif">-- Matt Calabrese</span></div><di=
v dir=3D"auto"><div class=3D"gmail_quote" dir=3D"auto"><blockquote class=3D=
"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding=
-left:1ex">
</blockquote></div></div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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 />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/CANh8DE%3DHX4obELdYGU8R6HOEQagbySYXyW=
qSpvKTWj7nhdnK2g%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">h=
ttps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CANh8DE%3DHX4ob=
ELdYGU8R6HOEQagbySYXyWqSpvKTWj7nhdnK2g%40mail.gmail.com</a>.<br />
--94eb2c05e33c4e77f6056846e7b4--
.
Author: Tony V E <tvaneerd@gmail.com>
Date: Sun, 25 Mar 2018 22:12:30 -0400
Raw View
--94eb2c09620862ca100568474eb3
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
That should be targeted to EWG not Core.
On Sun, Mar 25, 2018 at 9:23 PM, Jon Kalb <jon@kalbweb.com> wrote:
>
>
> Greetings,
>
>
>
> I=E2=80=99m working on a proposal to make the implicitly generated assign=
ment
> declarations be ref-qualified so that they only work on lvalue objects.
>
>
>
> My thinking is that assigning to a temporary is never a good idea and any
> code which does this is likely not doing what the author intended, so it
> should be caught by the compiler.
>
>
>
> The compiler will catch errors like this for fundamental types:
>
>
>
> int a{}, b{}, c{};
>
>
>
> a + b =3D c; // compile error
>
>
>
> But allows this for user-defined types that use the implicitly declared
> assignment operator:
>
>
>
> UDT a{}, b{}, c{};
>
>
>
> a + b =3D c; // Not a compile error, but an
> uncaught logic error.
>
> if ( (a + b) =3D c ) =E2=80=A6 // Did you mean =3D=3D? A=
s is, this
> compiles (assuming UDT converts to int).
>
>
>
> My proposal is that the signatures of the implicitly generated assignment
> operators be changed from this:
>
>
>
> X& X::operator=3D(X const&) or X& X::operator=3D(X&)
>
> And
>
> X& X::operator=3D(X &&)
>
>
>
> to this:
>
>
>
> X& X::operator=3D(X const&) & or X& X::operator=3D(X&) &
>
> And
>
> X& X::operator=3D(X &&) &
>
>
>
>
>
>
> My early rough draft of the proposal is here:
>
> http://exceptionsafecode.com/data/Don't%20Assign%20to%
> 20Temporaries.html
>
>
>
> Thanks.
>
>
>
> Jon
>
>
>
> --
> 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.
> To view this discussion on the web visit https://groups.google.com/a/
> isocpp.org/d/msgid/std-proposals/32DA2B8D-AF3F-42FC-
> AF24-58BA5612622A%40kalbweb.com
> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/32DA2B8D-AF=
3F-42FC-AF24-58BA5612622A%40kalbweb.com?utm_medium=3Demail&utm_source=3Dfoo=
ter>
> .
>
--=20
Be seeing you,
Tony
--=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.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/CAOHCbiuBTxRTUQbHLhqmjEpUOAg1ce4WC09t7jozuH8Cxar=
jyA%40mail.gmail.com.
--94eb2c09620862ca100568474eb3
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div><br><br></div>That should be targeted to EWG not Core=
..<br></div><div class=3D"gmail_extra"><br><div class=3D"gmail_quote">On Sun=
, Mar 25, 2018 at 9:23 PM, Jon Kalb <span dir=3D"ltr"><<a href=3D"mailto=
:jon@kalbweb.com" target=3D"_blank">jon@kalbweb.com</a>></span> wrote:<b=
r><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:=
1px #ccc solid;padding-left:1ex"><div bgcolor=3D"white" link=3D"#0563C1" vl=
ink=3D"#954F72" lang=3D"EN-US"><div class=3D"m_-5636120651111597058WordSect=
ion1"><p class=3D"MsoNormal"><span style=3D"font-size:11.0pt"><u></u>=C2=A0=
<u></u></span></p><p class=3D"MsoNormal"><span style=3D"font-size:11.0pt">G=
reetings,<u></u><u></u></span></p><p class=3D"MsoNormal"><span style=3D"fon=
t-size:11.0pt"><u></u>=C2=A0<u></u></span></p><p class=3D"MsoNormal"><span =
style=3D"font-size:11.0pt">I=E2=80=99m working on a proposal to make the im=
plicitly generated assignment declarations be ref-qualified so that they on=
ly work on lvalue objects.<u></u><u></u></span></p><p class=3D"MsoNormal"><=
span style=3D"font-size:11.0pt"><u></u>=C2=A0<u></u></span></p><p class=3D"=
MsoNormal"><span style=3D"font-size:11.0pt">My thinking is that assigning t=
o a temporary is never a good idea and any code which does this is likely n=
ot doing what the author intended, so it should be caught by the compiler.<=
u></u><u></u></span></p><p class=3D"MsoNormal"><span style=3D"font-size:11.=
0pt"><u></u>=C2=A0<u></u></span></p><p class=3D"MsoNormal"><span style=3D"f=
ont-size:11.0pt">The compiler will catch errors like this for fundamental t=
ypes:<u></u><u></u></span></p><p class=3D"MsoNormal"><span style=3D"font-si=
ze:11.0pt"><u></u>=C2=A0<u></u></span></p><p class=3D"MsoNormal" style=3D"t=
ext-indent:.5in"><span style=3D"font-size:11.0pt">int a{}, b{}, c{};<u></u>=
<u></u></span></p><p class=3D"MsoNormal"><span style=3D"font-size:11.0pt"><=
u></u>=C2=A0<u></u></span></p><p class=3D"MsoNormal" style=3D"text-indent:.=
5in"><span style=3D"font-size:11.0pt">a + b =3D c;=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0 // compile error<u></u><u></u></span></p><p class=3D"MsoNormal"><span s=
tyle=3D"font-size:11.0pt"><u></u>=C2=A0<u></u></span></p><p class=3D"MsoNor=
mal"><span style=3D"font-size:11.0pt">But allows this for user-defined type=
s that use the implicitly declared assignment operator:<u></u><u></u></span=
></p><p class=3D"MsoNormal"><span style=3D"font-size:11.0pt"><u></u>=C2=A0<=
u></u></span></p><p class=3D"MsoNormal" style=3D"text-indent:.5in"><span st=
yle=3D"font-size:11.0pt">UDT a{}, b{}, c{};<u></u><u></u></span></p><p clas=
s=3D"MsoNormal"><span style=3D"font-size:11.0pt"><u></u>=C2=A0<u></u></span=
></p><p class=3D"MsoNormal" style=3D"text-indent:.5in"><span style=3D"font-=
size:11.0pt">a + b =3D c;=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 // Not a compile err=
or, but an uncaught logic error.<u></u><u></u></span></p><p class=3D"MsoNor=
mal" style=3D"text-indent:.5in"><span style=3D"font-size:11.0pt">if ( (a + =
b) =3D c ) =E2=80=A6=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 // Did you mean =3D=3D? As=
is, this compiles (assuming UDT converts to int).<u></u><u></u></span></p>=
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt"><u></u>=C2=A0<u></u=
></span></p><p class=3D"MsoNormal"><span style=3D"font-size:11.0pt">My prop=
osal is that the signatures of the implicitly generated assignment operator=
s be changed from this:<u></u><u></u></span></p><p class=3D"MsoNormal"><spa=
n style=3D"font-size:11.0pt"><u></u>=C2=A0<u></u></span></p><p class=3D"Mso=
Normal"><span style=3D"font-size:11.0pt">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 X& X::operato=
r=3D(X const&) or X& X::operator=3D(X&) <u></u><u></u></span></=
p><p class=3D"MsoNormal"><span style=3D"font-size:11.0pt">=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
And<u></u><u></u></span></p><p class=3D"MsoNormal"><span style=3D"font-siz=
e:11.0pt">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0 X& X::operator=3D(X &&)<u></u><u></=
u></span></p><p class=3D"MsoNormal"><span style=3D"font-size:11.0pt"><u></u=
>=C2=A0<u></u></span></p><p class=3D"MsoNormal"><span style=3D"font-size:11=
..0pt">to this:<u></u><u></u></span></p><p class=3D"MsoNormal"><span style=
=3D"font-size:11.0pt"><u></u>=C2=A0<u></u></span></p><p class=3D"MsoNormal"=
><span style=3D"font-size:11.0pt">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 X& X::operator=3D(X=
const&) & or X& X::operator=3D(X&) &<u></u><u></u></sp=
an></p><p class=3D"MsoNormal"><span style=3D"font-size:11.0pt">=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0 And<u></u><u></u></span></p><p class=3D"MsoNormal"><span style=3D"font-=
size:11.0pt">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 X& X::operator=3D(X &&) &<u>=
</u><u></u></span></p><p class=3D"MsoNormal"><span style=3D"font-size:11.0p=
t"><u></u>=C2=A0<u></u></span></p><p class=3D"MsoNormal"><span style=3D"fon=
t-size:11.0pt"><u></u>=C2=A0<u></u></span></p><p class=3D"MsoNormal"><span =
style=3D"font-size:11.0pt"><br>My early rough draft of the proposal is here=
:<u></u><u></u></span></p><p class=3D"MsoNormal"><span style=3D"font-size:1=
1.0pt">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0 <a href=3D"http://exceptionsafecode.com/data/Don&#=
39;t%20Assign%20to%20Temporaries.html" target=3D"_blank">http://exceptionsa=
fecode.com/<wbr>data/Don't%20Assign%20to%<wbr>20Temporaries.html</a><u>=
</u><u></u></span></p><p class=3D"MsoNormal"><span style=3D"font-size:11.0p=
t"><u></u>=C2=A0<u></u></span></p><p class=3D"MsoNormal"><span style=3D"fon=
t-size:11.0pt">Thanks.<span class=3D"HOEnZb"><font color=3D"#888888"><u></u=
><u></u></font></span></span></p><span class=3D"HOEnZb"><font color=3D"#888=
888"><p class=3D"MsoNormal"><span style=3D"font-size:11.0pt"><u></u>=C2=A0<=
u></u></span></p><p class=3D"MsoNormal"><span style=3D"font-size:11.0pt">Jo=
n<u></u><u></u></span></p><p class=3D"MsoNormal"><span style=3D"font-size:1=
1.0pt"><u></u>=C2=A0<u></u></span></p></font></span></div></div><span class=
=3D"HOEnZb"><font color=3D"#888888">
<p></p>
-- <br>
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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" target=3D"_=
blank">std-proposals+unsubscribe@<wbr>isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">std-proposals@isocpp.org</a>.<br>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/32DA2B8D-AF3F-42FC-AF24-58BA5612622A%=
40kalbweb.com?utm_medium=3Demail&utm_source=3Dfooter" target=3D"_blank"=
>https://groups.google.com/a/<wbr>isocpp.org/d/msgid/std-<wbr>proposals/32D=
A2B8D-AF3F-42FC-<wbr>AF24-58BA5612622A%40kalbweb.<wbr>com</a>.<br>
</font></span></blockquote></div><br><br clear=3D"all"><br>-- <br><div clas=
s=3D"gmail_signature" data-smartmail=3D"gmail_signature"><div dir=3D"ltr"><=
div>Be seeing you,<br></div>Tony<br></div></div>
</div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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 />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/CAOHCbiuBTxRTUQbHLhqmjEpUOAg1ce4WC09t=
7jozuH8CxarjyA%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">htt=
ps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAOHCbiuBTxRTUQbH=
LhqmjEpUOAg1ce4WC09t7jozuH8CxarjyA%40mail.gmail.com</a>.<br />
--94eb2c09620862ca100568474eb3--
.
Author: Jon Kalb <jon@kalbweb.com>
Date: Sun, 25 Mar 2018 21:17:45 -0700 (PDT)
Raw View
------=_Part_12445_1869914738.1522037865993
Content-Type: multipart/alternative;
boundary="----=_Part_12446_1961924349.1522037865993"
------=_Part_12446_1961924349.1522037865993
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Glen Fernandes pointed out to me on Slack/CppLang#future_standard that this=
=20
can break if you have proxies:
https://paste.ubuntu.com/p/bMNfFPpyfH/
I'm not certain that you couldn't argue that this code is "broken" in the=
=20
sense you are using the "reference" proxy in way that behaves like the=20
proxy class happens to behave, but not the way that a reference would=20
behave. In others words, you are using the proxy class in a manner outside=
=20
of the use cases for which it was designed. Of course, if this is the way=
=20
that it is defined to behave, then people can have written code depending=
=20
on that behavior and that would break.
Jon
On Sunday, March 25, 2018 at 6:43:43 PM UTC-7, Matt Calabrese wrote:
>
>
> On Sun, Mar 25, 2018, 21:23 Jon Kalb <j...@kalbweb.com <javascript:>>=20
> wrote:
>
>> =20
>>
>> Greetings,
>>
>> =20
>>
>> I=E2=80=99m working on a proposal to make the implicitly generated assig=
nment=20
>> declarations be ref-qualified so that they only work on lvalue objects.
>>
>
> Hi Jon,
>
> This was considered for C++11 but wasn't accepted, though it was before m=
y=20
> time in the committee and I have not investigated the exact reasons for w=
hy=20
> it did not succeed. It may have simply been because it was breaking... ho=
wever,=20
> the committee seems to be more willing to make such breaking changes now=
=20
> and so a proposal is definitely worth it. I recommend investigating exact=
ly=20
> why C++11 did not go this route and include that in the paper along with=
=20
> why we should reconsider it now. One of the pre-c++11 papers that you may=
=20
> wish to check out is http://wg21.link/n2819 which proposed adding such=20
> ref-qualified operators to the standard library. It's probably worth=20
> getting in touch directly with those who were pushing for it in C++11.
>
> -- Matt Calabrese
>
>>
--=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.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/c3a8fcad-af98-4458-b86b-5d66c7f402ac%40isocpp.or=
g.
------=_Part_12446_1961924349.1522037865993
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">Glen Fernandes pointed out to me on Slack/CppLang#future_s=
tandard that this can break if you have proxies:<div>=C2=A0 =C2=A0=C2=A0htt=
ps://paste.ubuntu.com/p/bMNfFPpyfH/</div><div><br></div><div>I'm not ce=
rtain that you couldn't argue that this code is "broken" in t=
he sense you are using the "reference" proxy in way that behaves =
like the proxy class happens to behave, but not the way that a reference wo=
uld behave. In others words, you are using the proxy class in a manner outs=
ide of the use cases for which it was designed. Of course, if this is the w=
ay that it is defined to behave, then people can have written code dependin=
g on that behavior and that would break.</div><div><br></div><div>Jon<br><b=
r>On Sunday, March 25, 2018 at 6:43:43 PM UTC-7, Matt Calabrese wrote:<bloc=
kquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-l=
eft: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"auto"><div><br></div><d=
iv dir=3D"auto">On Sun, Mar 25, 2018, 21:23 Jon Kalb <<a href=3D"javascr=
ipt:" rel=3D"nofollow" target=3D"_blank" gdf-obfuscated-mailto=3D"DfR2jsDoA=
gAJ" onmousedown=3D"this.href=3D'javascript:';return true;" onclick=
=3D"this.href=3D'javascript:';return true;">j...@kalbweb.com</a>>=
; wrote:<br></div><div dir=3D"auto"><div class=3D"gmail_quote" dir=3D"auto"=
><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1=
px #ccc solid;padding-left:1ex"><div bgcolor=3D"white" lang=3D"EN-US" link=
=3D"#0563C1" vlink=3D"#954F72"><div><p class=3D"MsoNormal"><span style=3D"f=
ont-size:11.0pt"><u></u>=C2=A0<u></u></span></p><p class=3D"MsoNormal"><spa=
n style=3D"font-size:11.0pt">Greetings,<u></u><u></u></span></p><p class=3D=
"MsoNormal"><span style=3D"font-size:11.0pt"><u></u>=C2=A0<u></u></span></p=
><p class=3D"MsoNormal"><span style=3D"font-size:11.0pt">I=E2=80=99m workin=
g on a proposal to make the implicitly generated assignment declarations be=
ref-qualified so that they only work on lvalue objects.</span></p></div></=
div></blockquote></div></div><div dir=3D"auto"><br></div><div dir=3D"auto">=
<span style=3D"font-family:sans-serif">Hi Jon,</span><br></div><div dir=3D"=
auto"><span style=3D"font-family:sans-serif"><br></span></div><div dir=3D"a=
uto"><span style=3D"font-family:sans-serif">This was considered for C++11 b=
ut wasn't accepted, though it was before my time in the committee and I=
have not investigated the exact reasons for why it did not succeed. It may=
have simply been because it was breaking...</span><span style=3D"font-fami=
ly:sans-serif">=C2=A0however, the committee seems to be more willing to mak=
e such breaking changes now and so a proposal is definitely worth it. I rec=
ommend investigating exactly why C++11 did not go this route and include th=
at in the paper along with why we should reconsider it now. One of the pre-=
c++11 papers that you may wish to check out is <a href=3D"http://wg21.link/=
" target=3D"_blank" rel=3D"nofollow" onmousedown=3D"this.href=3D'http:/=
/www.google.com/url?q\x3dhttp%3A%2F%2Fwg21.link%2F\x26sa\x3dD\x26sntz\x3d1\=
x26usg\x3dAFQjCNGa8PNgPxWYOufQCyzw2kYREr4mbg';return true;" onclick=3D"=
this.href=3D'http://www.google.com/url?q\x3dhttp%3A%2F%2Fwg21.link%2F\x=
26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGa8PNgPxWYOufQCyzw2kYREr4mbg';re=
turn true;">http://wg21.link/</a></span><span style=3D"font-family:sans-ser=
if">n2819 which proposed adding such ref-qualified operators to the standar=
d library. It's probably worth getting in touch directly with those who=
were pushing for it in C++11.</span></div><div dir=3D"auto"><span style=3D=
"font-family:sans-serif"><br></span></div><div dir=3D"auto"><span style=3D"=
font-family:sans-serif">-- Matt Calabrese</span></div><div dir=3D"auto"><di=
v class=3D"gmail_quote" dir=3D"auto"><blockquote class=3D"gmail_quote" styl=
e=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
</blockquote></div></div></div>
</blockquote></div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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 />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/c3a8fcad-af98-4458-b86b-5d66c7f402ac%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/c3a8fcad-af98-4458-b86b-5d66c7f402ac=
%40isocpp.org</a>.<br />
------=_Part_12446_1961924349.1522037865993--
------=_Part_12445_1869914738.1522037865993--
.
Author: Jon Kalb <jon@kalbweb.com>
Date: Sun, 25 Mar 2018 21:17:54 -0700 (PDT)
Raw View
------=_Part_12645_1892391822.1522037874835
Content-Type: multipart/alternative;
boundary="----=_Part_12646_1016580136.1522037874836"
------=_Part_12646_1016580136.1522037874836
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Thanks.
On Sunday, March 25, 2018 at 7:12:32 PM UTC-7, Tony V E wrote:
>
>
>
> That should be targeted to EWG not Core.
>
> On Sun, Mar 25, 2018 at 9:23 PM, Jon Kalb <j...@kalbweb.com <javascript:>=
>=20
> wrote:
>
>> =20
>>
>> Greetings,
>>
>> =20
>>
>> I=E2=80=99m working on a proposal to make the implicitly generated assig=
nment=20
>> declarations be ref-qualified so that they only work on lvalue objects.
>>
>> =20
>>
>> My thinking is that assigning to a temporary is never a good idea and an=
y=20
>> code which does this is likely not doing what the author intended, so it=
=20
>> should be caught by the compiler.
>>
>> =20
>>
>> The compiler will catch errors like this for fundamental types:
>>
>> =20
>>
>> int a{}, b{}, c{};
>>
>> =20
>>
>> a + b =3D c; // compile error
>>
>> =20
>>
>> But allows this for user-defined types that use the implicitly declared=
=20
>> assignment operator:
>>
>> =20
>>
>> UDT a{}, b{}, c{};
>>
>> =20
>>
>> a + b =3D c; // Not a compile error, but a=
n=20
>> uncaught logic error.
>>
>> if ( (a + b) =3D c ) =E2=80=A6 // Did you mean =3D=3D? =
As is, this=20
>> compiles (assuming UDT converts to int).
>>
>> =20
>>
>> My proposal is that the signatures of the implicitly generated assignmen=
t=20
>> operators be changed from this:
>>
>> =20
>>
>> X& X::operator=3D(X const&) or X& X::operator=3D(X&)=20
>>
>> And
>>
>> X& X::operator=3D(X &&)
>>
>> =20
>>
>> to this:
>>
>> =20
>>
>> X& X::operator=3D(X const&) & or X& X::operator=3D(X&) &
>>
>> And
>>
>> X& X::operator=3D(X &&) &
>>
>> =20
>>
>> =20
>>
>>
>> My early rough draft of the proposal is here:
>>
>> =20
>> http://exceptionsafecode.com/data/Don't%20Assign%20to%20Temporaries.html
>>
>> =20
>>
>> Thanks.
>>
>> =20
>>
>> Jon
>>
>> =20
>>
>> --=20
>> You received this message because you are subscribed to the Google Group=
s=20
>> "ISO C++ Standard - Future Proposals" group.
>> To unsubscribe from this group and stop receiving emails from it, send a=
n=20
>> email to std-proposal...@isocpp.org <javascript:>.
>> To post to this group, send email to std-pr...@isocpp.org <javascript:>.
>> To view this discussion on the web visit=20
>> https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/32DA2B8D-AF=
3F-42FC-AF24-58BA5612622A%40kalbweb.com=20
>> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/32DA2B8D-A=
F3F-42FC-AF24-58BA5612622A%40kalbweb.com?utm_medium=3Demail&utm_source=3Dfo=
oter>
>> .
>>
>
>
>
> --=20
> Be seeing you,
> Tony
>
--=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.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/ea0e9539-a8ec-4410-b8ad-a5b11ddb6850%40isocpp.or=
g.
------=_Part_12646_1016580136.1522037874836
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">Thanks.<br><br>On Sunday, March 25, 2018 at 7:12:32 PM UTC=
-7, Tony V E wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;mar=
gin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D=
"ltr"><div><br><br></div>That should be targeted to EWG not Core.<br></div>=
<div><br><div class=3D"gmail_quote">On Sun, Mar 25, 2018 at 9:23 PM, Jon Ka=
lb <span dir=3D"ltr"><<a href=3D"javascript:" target=3D"_blank" gdf-obfu=
scated-mailto=3D"4IJvHFPqAgAJ" rel=3D"nofollow" onmousedown=3D"this.href=3D=
'javascript:';return true;" onclick=3D"this.href=3D'javascript:=
';return true;">j...@kalbweb.com</a>></span> wrote:<br><blockquote c=
lass=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;=
padding-left:1ex"><div bgcolor=3D"white" link=3D"#0563C1" vlink=3D"#954F72"=
lang=3D"EN-US"><div><p class=3D"MsoNormal"><span style=3D"font-size:11.0pt=
"><u></u>=C2=A0<u></u></span></p><p class=3D"MsoNormal"><span style=3D"font=
-size:11.0pt">Greetings,<u></u><u></u></span></p><p class=3D"MsoNormal"><sp=
an style=3D"font-size:11.0pt"><u></u>=C2=A0<u></u></span></p><p class=3D"Ms=
oNormal"><span style=3D"font-size:11.0pt">I=E2=80=99m working on a proposal=
to make the implicitly generated assignment declarations be ref-qualified =
so that they only work on lvalue objects.<u></u><u></u></span></p><p class=
=3D"MsoNormal"><span style=3D"font-size:11.0pt"><u></u>=C2=A0<u></u></span>=
</p><p class=3D"MsoNormal"><span style=3D"font-size:11.0pt">My thinking is =
that assigning to a temporary is never a good idea and any code which does =
this is likely not doing what the author intended, so it should be caught b=
y the compiler.<u></u><u></u></span></p><p class=3D"MsoNormal"><span style=
=3D"font-size:11.0pt"><u></u>=C2=A0<u></u></span></p><p class=3D"MsoNormal"=
><span style=3D"font-size:11.0pt">The compiler will catch errors like this =
for fundamental types:<u></u><u></u></span></p><p class=3D"MsoNormal"><span=
style=3D"font-size:11.0pt"><u></u>=C2=A0<u></u></span></p><p class=3D"MsoN=
ormal" style=3D"text-indent:.5in"><span style=3D"font-size:11.0pt">int a{},=
b{}, c{};<u></u><u></u></span></p><p class=3D"MsoNormal"><span style=3D"fo=
nt-size:11.0pt"><u></u>=C2=A0<u></u></span></p><p class=3D"MsoNormal" style=
=3D"text-indent:.5in"><span style=3D"font-size:11.0pt">a + b =3D c;=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0 // compile error<u></u><u></u></span></p><p class=3D"=
MsoNormal"><span style=3D"font-size:11.0pt"><u></u>=C2=A0<u></u></span></p>=
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt">But allows this for=
user-defined types that use the implicitly declared assignment operator:<u=
></u><u></u></span></p><p class=3D"MsoNormal"><span style=3D"font-size:11.0=
pt"><u></u>=C2=A0<u></u></span></p><p class=3D"MsoNormal" style=3D"text-ind=
ent:.5in"><span style=3D"font-size:11.0pt">UDT a{}, b{}, c{};<u></u><u></u>=
</span></p><p class=3D"MsoNormal"><span style=3D"font-size:11.0pt"><u></u>=
=C2=A0<u></u></span></p><p class=3D"MsoNormal" style=3D"text-indent:.5in"><=
span style=3D"font-size:11.0pt">a + b =3D c;=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 //=
Not a compile error, but an uncaught logic error.<u></u><u></u></span></p>=
<p class=3D"MsoNormal" style=3D"text-indent:.5in"><span style=3D"font-size:=
11.0pt">if ( (a + b) =3D c ) =E2=80=A6=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 // Did y=
ou mean =3D=3D? As is, this compiles (assuming UDT converts to int).<u></u>=
<u></u></span></p><p class=3D"MsoNormal"><span style=3D"font-size:11.0pt"><=
u></u>=C2=A0<u></u></span></p><p class=3D"MsoNormal"><span style=3D"font-si=
ze:11.0pt">My proposal is that the signatures of the implicitly generated a=
ssignment operators be changed from this:<u></u><u></u></span></p><p class=
=3D"MsoNormal"><span style=3D"font-size:11.0pt"><u></u>=C2=A0<u></u></span>=
</p><p class=3D"MsoNormal"><span style=3D"font-size:11.0pt">=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
X& X::operator=3D(X const&) or X& X::operator=3D(X&) <u></=
u><u></u></span></p><p class=3D"MsoNormal"><span style=3D"font-size:11.0pt"=
>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0 And<u></u><u></u></span></p><p class=3D"MsoNormal"><span=
style=3D"font-size:11.0pt">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 X& X::operator=3D(X &=
&)<u></u><u></u></span></p><p class=3D"MsoNormal"><span style=3D"font-s=
ize:11.0pt"><u></u>=C2=A0<u></u></span></p><p class=3D"MsoNormal"><span sty=
le=3D"font-size:11.0pt">to this:<u></u><u></u></span></p><p class=3D"MsoNor=
mal"><span style=3D"font-size:11.0pt"><u></u>=C2=A0<u></u></span></p><p cla=
ss=3D"MsoNormal"><span style=3D"font-size:11.0pt">=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 X& X=
::operator=3D(X const&) & or X& X::operator=3D(X&) &<u>=
</u><u></u></span></p><p class=3D"MsoNormal"><span style=3D"font-size:11.0p=
t">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0 And<u></u><u></u></span></p><p class=3D"MsoNormal"><span=
style=3D"font-size:11.0pt">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 X& X::operator=3D(X &=
&) &<u></u><u></u></span></p><p class=3D"MsoNormal"><span style=3D"=
font-size:11.0pt"><u></u>=C2=A0<u></u></span></p><p class=3D"MsoNormal"><sp=
an style=3D"font-size:11.0pt"><u></u>=C2=A0<u></u></span></p><p class=3D"Ms=
oNormal"><span style=3D"font-size:11.0pt"><br>My early rough draft of the p=
roposal is here:<u></u><u></u></span></p><p class=3D"MsoNormal"><span style=
=3D"font-size:11.0pt">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 <a href=3D"http://exceptionsafecode=
..com/data/Don't%20Assign%20to%20Temporaries.html" target=3D"_blank" rel=
=3D"nofollow" onmousedown=3D"this.href=3D'http://www.google.com/url?q\x=
3dhttp%3A%2F%2Fexceptionsafecode.com%2Fdata%2FDon\x27t%2520Assign%2520to%25=
20Temporaries.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFm9-cL-hooxh15zj=
U64Y4dDzQrHg';return true;" onclick=3D"this.href=3D'http://www.goog=
le.com/url?q\x3dhttp%3A%2F%2Fexceptionsafecode.com%2Fdata%2FDon\x27t%2520As=
sign%2520to%2520Temporaries.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFm=
9-cL-hooxh15zjU64Y4dDzQrHg';return true;">http://exceptionsafecode.com/=
<wbr>data/Don't%20Assign%20to%<wbr>20Temporaries.html</a><u></u><u></u>=
</span></p><p class=3D"MsoNormal"><span style=3D"font-size:11.0pt"><u></u>=
=C2=A0<u></u></span></p><p class=3D"MsoNormal"><span style=3D"font-size:11.=
0pt">Thanks.<span><font color=3D"#888888"><u></u><u></u></font></span></spa=
n></p><span><font color=3D"#888888"><p class=3D"MsoNormal"><span style=3D"f=
ont-size:11.0pt"><u></u>=C2=A0<u></u></span></p><p class=3D"MsoNormal"><spa=
n style=3D"font-size:11.0pt">Jon<u></u><u></u></span></p><p class=3D"MsoNor=
mal"><span style=3D"font-size:11.0pt"><u></u>=C2=A0<u></u></span></p></font=
></span></div></div><span><font color=3D"#888888">
<p></p>
-- <br>
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br>
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"javascript:" target=3D"_blank" gdf-obfuscated-mailto=3D"=
4IJvHFPqAgAJ" rel=3D"nofollow" onmousedown=3D"this.href=3D'javascript:&=
#39;;return true;" onclick=3D"this.href=3D'javascript:';return true=
;">std-proposal...@<wbr>isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"javascript:" target=3D"_bla=
nk" gdf-obfuscated-mailto=3D"4IJvHFPqAgAJ" rel=3D"nofollow" onmousedown=3D"=
this.href=3D'javascript:';return true;" onclick=3D"this.href=3D'=
;javascript:';return true;">std-pr...@isocpp.org</a>.<br>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/32DA2B8D-AF3F-42FC-AF24-58BA5612622A%=
40kalbweb.com?utm_medium=3Demail&utm_source=3Dfooter" target=3D"_blank"=
rel=3D"nofollow" onmousedown=3D"this.href=3D'https://groups.google.com=
/a/isocpp.org/d/msgid/std-proposals/32DA2B8D-AF3F-42FC-AF24-58BA5612622A%40=
kalbweb.com?utm_medium\x3demail\x26utm_source\x3dfooter';return true;" =
onclick=3D"this.href=3D'https://groups.google.com/a/isocpp.org/d/msgid/=
std-proposals/32DA2B8D-AF3F-42FC-AF24-58BA5612622A%40kalbweb.com?utm_medium=
\x3demail\x26utm_source\x3dfooter';return true;">https://groups.google.=
com/a/<wbr>isocpp.org/d/msgid/std-<wbr>proposals/32DA2B8D-AF3F-42FC-<wbr>AF=
24-58BA5612622A%40kalbweb.<wbr>com</a>.<br>
</font></span></blockquote></div><br><br clear=3D"all"><br>-- <br><div><div=
dir=3D"ltr"><div>Be seeing you,<br></div>Tony<br></div></div>
</div>
</blockquote></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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 />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/ea0e9539-a8ec-4410-b8ad-a5b11ddb6850%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/ea0e9539-a8ec-4410-b8ad-a5b11ddb6850=
%40isocpp.org</a>.<br />
------=_Part_12646_1016580136.1522037874836--
------=_Part_12645_1892391822.1522037874835--
.
Author: Glen Fernandes <glen.fernandes@gmail.com>
Date: Sun, 25 Mar 2018 22:25:59 -0700 (PDT)
Raw View
------=_Part_12872_180812539.1522041959897
Content-Type: multipart/alternative;
boundary="----=_Part_12873_438088175.1522041959897"
------=_Part_12873_438088175.1522041959897
Content-Type: text/plain; charset="UTF-8"
On Monday, March 26, 2018 at 12:17:46 AM UTC-4, Jon Kalb wrote:
>
> Glen Fernandes pointed out to me on Slack/CppLang#future_standard that
> this can break if you have proxies:
> https://paste.ubuntu.com/p/bMNfFPpyfH/
> <https://www.google.com/url?q=https%3A%2F%2Fpaste.ubuntu.com%2Fp%2FbMNfFPpyfH%2F&sa=D&sntz=1&usg=AFQjCNFyvl0NMQPEUfhZ4hqMY7rMI1zEow>
>
>
(Or https://paste.ubuntu.com/p/hdKMxfmzfZ/
or https://paste.ubuntu.com/p/GtMQqM36v5/ etc.)
Allowing assignment to temporaries for proxy types is intended.
e.g. std::tie(x,y) = std::tie(p, q);
If someone had a type like the following:
struct S {
std::tuple<X&, Y&> t;
};
Then assignment to a temporary of type S is just as meaningful as
assignment to an temporary of tuple<X&,Y&> in the tie(x,y)=tie(p,q); case
above.
Your proposed change would break that, e.g. f() = g(); (where f() and g()
return S) would now fail to compile.
You can substitute tuple<X&,Y&> with another similar proxy type like
bitset<N>::reference for a similar example.
On the other hand: N2819 would not be addressed by your proposed change at
all. i.e. The specific standard library facilities that people want to have
&-qualified operator=() would still not have it.
Glen
>
--
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.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/f05707a9-c727-40a3-9d24-7b877eaef7f4%40isocpp.org.
------=_Part_12873_438088175.1522041959897
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">On Monday, March 26, 2018 at 12:17:46 AM UTC-4, Jon Kalb w=
rote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8e=
x;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr">Glen Fer=
nandes pointed out to me on Slack/CppLang#future_standard that this can bre=
ak if you have proxies:<div><a href=3D"https://www.google.com/url?q=3Dhttps=
%3A%2F%2Fpaste.ubuntu.com%2Fp%2FbMNfFPpyfH%2F&sa=3DD&sntz=3D1&u=
sg=3DAFQjCNFyvl0NMQPEUfhZ4hqMY7rMI1zEow" target=3D"_blank" rel=3D"nofollow"=
onmousedown=3D"this.href=3D'https://www.google.com/url?q\x3dhttps%3A%2=
F%2Fpaste.ubuntu.com%2Fp%2FbMNfFPpyfH%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3d=
AFQjCNFyvl0NMQPEUfhZ4hqMY7rMI1zEow';return true;" onclick=3D"this.href=
=3D'https://www.google.com/url?q\x3dhttps%3A%2F%2Fpaste.ubuntu.com%2Fp%=
2FbMNfFPpyfH%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFyvl0NMQPEUfhZ4hqMY=
7rMI1zEow';return true;">https://paste.ubuntu.com/p/<wbr>bMNfFPpyfH/</a=
></div><div><br></div></div></blockquote><div><br></div><div>(Or https://pa=
ste.ubuntu.com/p/hdKMxfmzfZ/ or=C2=A0https://paste.ubuntu.com/p/GtMQqM36v5/=
etc.)</div><div><br></div><div>Allowing assignment to temporaries for prox=
y types is intended.</div><div>e.g. std::tie(x,y) =3D std::tie(p, q);</div>=
<div><br></div><div>If someone had a type like the following:</div><div>str=
uct S {</div><div>=C2=A0 =C2=A0std::tuple<X&, Y&> t;</div><di=
v>};</div><div><br></div><div>Then assignment to a temporary of type S is j=
ust as meaningful as assignment to an temporary of tuple<X&,Y&&g=
t; in the tie(x,y)=3Dtie(p,q); case above.</div><div><br></div><div>Your pr=
oposed change would break that, e.g. f() =3D g(); (where f() and g() return=
S) would now fail to compile.</div><div><br></div><div>You can substitute =
tuple<X&,Y&> with another similar proxy type like bitset<N=
>::reference for a similar example.</div><div><br></div><div>On the othe=
r hand: N2819 would not be addressed by your proposed change at all. i.e. T=
he specific standard library facilities that people want to have &-qual=
ified operator=3D() would still=C2=A0not have it.</div><div><br></div><div>=
Glen</div><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"><bl=
ockquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-l=
eft:1px #ccc solid;padding-left:1ex"><div dir=3D"auto"><div dir=3D"auto"><d=
iv class=3D"gmail_quote" dir=3D"auto"><blockquote class=3D"gmail_quote" sty=
le=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
</blockquote></div></div></div>
</blockquote></div></blockquote></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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 />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/f05707a9-c727-40a3-9d24-7b877eaef7f4%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/f05707a9-c727-40a3-9d24-7b877eaef7f4=
%40isocpp.org</a>.<br />
------=_Part_12873_438088175.1522041959897--
------=_Part_12872_180812539.1522041959897--
.
Author: =?UTF-8?Q?Daniel_Kr=C3=BCgler?= <daniel.kruegler@gmail.com>
Date: Mon, 26 Mar 2018 18:46:41 +0200
Raw View
2018-03-26 3:43 GMT+02:00 'Matt Calabrese' via ISO C++ Standard -
Future Proposals <std-proposals@isocpp.org>:
>
> On Sun, Mar 25, 2018, 21:23 Jon Kalb <jon@kalbweb.com> wrote:
>>
>>
>>
>> Greetings,
>>
>>
>>
>> I=E2=80=99m working on a proposal to make the implicitly generated assig=
nment
>> declarations be ref-qualified so that they only work on lvalue objects.
>
>
> Hi Jon,
>
> This was considered for C++11 but wasn't accepted, though it was before m=
y
> time in the committee and I have not investigated the exact reasons for w=
hy
> it did not succeed. It may have simply been because it was breaking...
> however, the committee seems to be more willing to make such breaking
> changes now and so a proposal is definitely worth it. I recommend
> investigating exactly why C++11 did not go this route and include that in
> the paper along with why we should reconsider it now. One of the pre-c++1=
1
> papers that you may wish to check out is http://wg21.link/n2819 which
> proposed adding such ref-qualified operators to the standard library. It'=
s
> probably worth getting in touch directly with those who were pushing for =
it
> in C++11.
As an anecdote it might be interesting to note that *because* of the
failure of the acceptance of N2819, the corresponding CWG issue was
closed because of reduced amount of motivation:
http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_closed.html#733
- Daniel
--=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.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/CAGNvRgB%3Du_27Hgaj19yDcHkGWnH0WN4X8td-KXPRmhB3S=
ooJiw%40mail.gmail.com.
.