Topic: Does =default constitute a user declaration of an


Author: John Yates <john@yates-sheets.org>
Date: Tue, 2 Feb 2016 17:59:11 -0500
Raw View
--94eb2c0b8c0e22b0cb052ad1735d
Content-Type: text/plain; charset=UTF-8

For a while I have been writing

class MyClass {
public:
  ...
  ~MyClass() =default;
  ...
};


to make explicit that MyClass has unremarkable destruction semantics.
Lately I have discovered that clang may issue a warning such as:

warning: definition of implicit copy constructor for 'IntRange' is
deprecated because it has a user-declared destructor [-Wdeprecated]


Of course I was able to fix this by also including

MyClass(MyClass const&) =default;


My sense is that the logic of this warning is that if one has to write
one's own destructor then it is unlikely that a language provided copy
constructor can be correct.  But when one writes "=default" one is not
writing one's own destructor.  Rather one is asserting that the language
supplied implementation is entirely adequate.

Am I missing something?

/john

--

---
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 https://groups.google.com/a/isocpp.org/group/std-proposals/.

--94eb2c0b8c0e22b0cb052ad1735d
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">For a while I have been writing<div><br></div><blockquote =
style=3D"margin:0 0 0 40px;border:none;padding:0px"><div><font face=3D"mono=
space, monospace">class MyClass {</font></div><div><font face=3D"monospace,=
 monospace">public:</font></div><div><font face=3D"monospace, monospace">=
=C2=A0 ...</font></div><div><font face=3D"monospace, monospace">=C2=A0 ~MyC=
lass() =3Ddefault;</font></div><div><font face=3D"monospace, monospace">=C2=
=A0 ...</font></div><div><font face=3D"monospace, monospace">};</font></div=
></blockquote><div><br></div><div>to make explicit that MyClass has unremar=
kable destruction semantics.=C2=A0 Lately I have discovered that clang may =
issue a warning such as:<div><br></div></div><blockquote style=3D"margin:0 =
0 0 40px;border:none;padding:0px"><div><div><font face=3D"monospace, monosp=
ace">warning: definition of implicit copy constructor for &#39;IntRange&#39=
; is deprecated because it has a user-declared destructor [-Wdeprecated]</f=
ont></div></div></blockquote><div><div><br></div><div>Of course I was able =
to fix this by also including</div><div><br></div></div><blockquote style=
=3D"margin:0 0 0 40px;border:none;padding:0px"><div><div><font face=3D"mono=
space, monospace">MyClass(MyClass const&amp;) =3Ddefault;</font></div></div=
></blockquote><div><div><br></div><div>My sense is that the logic of this w=
arning is that if one has to write one&#39;s own destructor then it is unli=
kely that a language provided copy constructor can be correct.=C2=A0 But wh=
en one writes &quot;=3Ddefault&quot; one is not writing one&#39;s own destr=
uctor.=C2=A0 Rather one is asserting that the language supplied implementat=
ion is entirely adequate.</div><div><br></div><div>Am I missing something?<=
/div><div><br></div><div>/john</div><div><br></div><div><br></div></div></d=
iv>

<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"https://groups.google.com/a/isocpp.org/group=
/std-proposals/">https://groups.google.com/a/isocpp.org/group/std-proposals=
/</a>.<br />

--94eb2c0b8c0e22b0cb052ad1735d--

.