Topic: Defect? Both gcc and clang instantiate constructors
Author: Boris Rasin <rasin.boris@gmail.com>
Date: Tue, 26 Jun 2018 00:56:50 -0700 (PDT)
Raw View
------=_Part_8550_2082537223.1529999810220
Content-Type: multipart/alternative;
boundary="----=_Part_8551_980520236.1529999810220"
------=_Part_8551_980520236.1529999810220
Content-Type: text/plain; charset="UTF-8"
// Both clang and gcc (in C++17 mode) complain about "invalid use of
incomplete type".
// But if all A's constructors are "=deleted", both clang and gcc compile
successfully.
// They don't need ANY constructor, yet try to instantiate them all.
// Is this somehow mandated by the standard, or simply a bug in both clang
and gcc?
template <typename T>
struct A
{
using type = typenameT::type;
A(type);
};
struct B;
A<B> func();
A<B> func2() { return func(); }
--
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/1dade9c8-f42d-4769-a9f0-16233e47327d%40isocpp.org.
------=_Part_8551_980520236.1529999810220
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div class=3D""><span style=3D"color: rgb(0, 0, 255);" cla=
ss=3D"">// Both clang and gcc (in C++17 mode) complain about "invalid =
use of incomplete type".<br></span></div><div class=3D""><span style=
=3D"color: rgb(0, 0, 255);" class=3D"">// But if all A's constructors a=
re "=3Ddeleted", both clang and gcc compile successfully.<br></sp=
an></div><div class=3D""><span style=3D"color: rgb(0, 0, 255);" class=3D"">=
// They don't need ANY constructor, yet try to instantiate them all.</s=
pan></div><div class=3D""><span style=3D"color: rgb(0, 0, 255);" class=3D""=
>// Is this somehow mandated by the standard, or simply a bug in both clang=
and gcc?</span></div><div class=3D""><span style=3D"color: rgb(0, 0, 255);=
" class=3D""></span></div><div class=3D""><span style=3D"color: rgb(0, 0, 2=
55);" class=3D""><br></span></div><div class=3D""><span style=3D"color: rgb=
(0, 0, 255);" class=3D"">template</span> <<span style=3D"color: rgb(0, 0=
, 255);" class=3D"">typename</span> T></div><div class=3D""><span style=
=3D"color: rgb(0, 0, 255);" class=3D"">struct </span>A</div><div class=3D""=
>{</div><div class=3D""><span style=3D"color: rgb(0, 0, 255);" class=3D"">=
=C2=A0 using type =3D </span><span style=3D"color: rgb(0, 0, 255);" class=
=3D"">typename</span>T::type;</div><div class=3D"">=C2=A0 A(type);</div><di=
v class=3D"">};</div><br class=3D""><div class=3D""><span style=3D"color: r=
gb(0, 0, 255);" class=3D"">struct</span> B;</div><br class=3D""><div class=
=3D"">A<B> func();</div><div class=3D"">A<B> func2() {=C2=A0<sp=
an style=3D"color: rgb(0, 0, 255);" class=3D"">return </span>func(); }</div=
><div class=3D""><br></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/1dade9c8-f42d-4769-a9f0-16233e47327d%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/1dade9c8-f42d-4769-a9f0-16233e47327d=
%40isocpp.org</a>.<br />
------=_Part_8551_980520236.1529999810220--
------=_Part_8550_2082537223.1529999810220--
.