220 38903 <975ab4cd-2ff0-4a09-9fac-7c37dc67cf16@isocpp.org> article
Path: news.gmane.org!.POSTED!not-for-mail
From: mihailnajdenov@gmail.com
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Allow forward class declarations to match a type alias.
Date: Fri, 29 Jun 2018 01:48:26 -0700 (PDT)
Lines: 176
Approved: news@gmane.org
Message-ID: <975ab4cd-2ff0-4a09-9fac-7c37dc67cf16@isocpp.org>
References: <b2fb570b-aadb-423e-9821-025cb447cf60@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_11175_15024228.1530262106687"
X-Trace: blaine.gmane.org 1530261982 11022 195.159.176.226 (29 Jun 2018 08:46:22 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Fri, 29 Jun 2018 08:46:22 +0000 (UTC)
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBCUJ3A7GRAPRBW7E27MQKGQENTNBD3A@isocpp.org Fri Jun 29 10:46:18 2018
Return-path: <std-proposals+bncBCUJ3A7GRAPRBW7E27MQKGQENTNBD3A@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-yw0-f198.google.com ([209.85.161.198])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCUJ3A7GRAPRBW7E27MQKGQENTNBD3A@isocpp.org>)
	id 1fYp2n-0002m7-3T
	for gclcip-std-proposals@m.gmane.org; Fri, 29 Jun 2018 10:46:17 +0200
Original-Received: by mail-yw0-f198.google.com with SMTP id t132-v6sf7136952ywa.6
        for <gclcip-std-proposals@m.gmane.org>; Fri, 29 Jun 2018 01:48:28 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=date:from:to:message-id:in-reply-to:references:subject:mime-version
         :x-original-sender:reply-to:precedence:mailing-list:list-id
         :list-post:list-help:list-archive:list-subscribe:list-unsubscribe;
        bh=r3VjXB7EMTaayHp1lP5y2cPpsV8jd8vzrrd8bluq3Ss=;
        b=dARZ4Kn0PBBeK56DQZXW+0iJ/yKsVS4KEUNNRkta0WAWuz2K+wPoXA1F+PrWYEMSJX
         r4SqnPUGb4OgA1Dd8rnG86rn0g3BPVZRQuG6iW9CZv/cai987LXOx4L0bnOPq6qzn8b8
         MRSlkg3Wrbd25Wf1Hs1KoTWAHfemdnojqG0C0g84kWw6ozn+CEK3ZY7iUtGdDjt3AhxD
         Usmb1PL+7ItIe4MhDmBlnnkYUzkJNPJeee8AoKZjIQuqyvxTjP4m5e7g81qsuJU0kv/M
         RYk6CaKCnD+yw1k894SMDTOKttoIZO1mlxSD8yxCfOLsTJ24G5h0htW1nbxLdS4uNlaw
         5/CA==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=date:from:to:message-id:in-reply-to:references:subject:mime-version
         :x-original-sender:reply-to:precedence:mailing-list:list-id
         :list-post:list-help:list-archive:list-subscribe:list-unsubscribe;
        bh=r3VjXB7EMTaayHp1lP5y2cPpsV8jd8vzrrd8bluq3Ss=;
        b=btBQ7psBz0DoPaU8lFM3gEd8JMn3L9Noa/+BA6JL5g3DtsFhE2S3lTPHx4bDpUBQdL
         j6pmEVuovp2x7rbzmcUHT9FP40BRf3BouCtgCLHWatP1fXvA2wMMuOqFvZxjFZNzEsGw
         Ar/TDsRw/t6ybrxz7BV/gMh+/MAUrtxZIbbMoO5MrWKHrVSD0ahptygjcLlSZpQNQ7G7
         BCNS6TRqNtvwPXQIw5bFpCGE1e6utRlxpU9LOD7vN7DnuR3OLniiPhOEz0M23oPetQPT
         A1EIsKGgCgxmaeHrZX8oPuepNMPFco/4kzKGVNymYhWMGz6hlVWIHDaYv2zO4mr/Gnvm
         hKCA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:date:from:to:message-id:in-reply-to:references
         :subject:mime-version:x-original-sender:reply-to:precedence
         :mailing-list:list-id:x-spam-checked-in-group:list-post:list-help
         :list-archive:list-subscribe:list-unsubscribe;
        bh=r3VjXB7EMTaayHp1lP5y2cPpsV8jd8vzrrd8bluq3Ss=;
        b=hxQtpeMMOxas4NJ9SPImzx26Pc8Z1HBXztR2BTS4BwOMHHYX8FfyiOe1psBidfoNq7
         vFCBidPfw0DUsMi0Xe//pTo27k93TTJ83q6iwv1xQdq6XDox5qCpPGFtejRKDfWCOewl
         LOb69h++jhSiMpGllSOg0MXEzEMe+ogur8ZRZ4vqUZdrWRBxGc/6aHzuRIhqPtbWJSwO
         cwnDmToyTtnE9HJq9oLdh63NaxSBBud3vQ4e4SeiJCnX7AYc4s+usraqQidKnv71tjP8
         TWDbflkN1ITTnDp1dR8sO0Q97b5Si9cjc8uyr4zmtgPgjjPIU9r2FOjM3cu7cYSQhZcV
         g1vw==
X-Gm-Message-State: APt69E3V4EQ45vtX/w8DIEaXP/zylYVPTCvsLIpkBvvSQ+nUojB6qu5V
	6PKpUz0KDGlafGsfoEYt54h5qA==
X-Google-Smtp-Source: AAOMgpfI+3MawzKBIW3g2nhXXUEGsxsAI6Bmi1g4Z9ZvPLJHKTlFk4bvpIcS2ijMgVnxeOczv41ALw==
X-Received: by 2002:a81:6ca:: with SMTP id 193-v6mr3777878ywg.115.1530262108377;
        Fri, 29 Jun 2018 01:48:28 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 2002:a0d:ce42:: with SMTP id q63-v6ls1491148ywd.34.gmail; Fri, 29
 Jun 2018 01:48:27 -0700 (PDT)
X-Received: by 2002:a0d:f781:: with SMTP id h123-v6mr1263726ywf.2.1530262107383;
        Fri, 29 Jun 2018 01:48:27 -0700 (PDT)
In-Reply-To: <b2fb570b-aadb-423e-9821-025cb447cf60@isocpp.org>
X-Original-Sender: MihailNajdenov@gmail.com
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <std-proposals.isocpp.org>
X-Spam-Checked-In-Group: std-proposals@isocpp.org
X-Google-Group-Id: 399137483710
List-Post: <https://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <https://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <https://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <https://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>,
 <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:38903
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/38903>

------=_Part_11175_15024228.1530262106687
Content-Type: multipart/alternative; 
	boundary="----=_Part_11176_1127489972.1530262106688"

------=_Part_11176_1127489972.1530262106688
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

We have to see what is the situation after Modules.=20

For now your best bet is to actually create a class=20
class FloatImage : public CudaImage<float> { /*using =E2=80=A6*/ };


On Friday, June 29, 2018 at 10:56:26 AM UTC+3, Bengt Gustafsson wrote:
>
> A forward declaration of a class name is currently not allowed to be=20
> resolved by a type alias of a class template. I don't see the logic to=20
> this, why is this illegal:
>
> // forward declaration in one header file.
> class FloatImage;
>
>
> // Definition in another header file.
> template<typename T> class CudaImage {
> };
>
> using FloatImage =3D CudaImage<float>;
>
>
> Godbolt: https://godbolt.org/g/mmTTeQ shows that all compilers reject=20
> this.
>
> This has  created a fair amount of trouble for me when trying to refactor=
=20
> what was previously a FloatImage class to a generic pixel type template. =
I=20
> don't see the logic to making this
> illegal as FloatImage is still the name of a class, i.e. an instance of=
=20
> the CudaImage class template.
>
> While I can update the forward declaration to:
> // forward declaration in one header file.
> template<typename T> class CudaImage;
> using FloatImage =3D CudaImage<float>;
>
> This seems to be an unnecessary leakage of implementation detail.
>
> so is there a technical reason preventing this from being allowed or is i=
t=20
> just an oversight that could be corrected?
>
>

--=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/975ab4cd-2ff0-4a09-9fac-7c37dc67cf16%40isocpp.or=
g.

------=_Part_11176_1127489972.1530262106688
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>We have to see what is the situation after Modules.=
=C2=A0</div><div><br></div><div>For now your best bet is to actually create=
 a class=C2=A0<span style=3D"background-color: transparent; border-bottom-c=
olor: rgb(0, 0, 0); border-bottom-style: none; border-bottom-width: 0px; bo=
rder-image-outset: 0; border-image-repeat: stretch; border-image-slice: 100=
%; border-image-source: none; border-image-width: 1; border-left-color: rgb=
(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-co=
lor: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; borde=
r-top-color: rgb(0, 0, 0); border-top-style: none; border-top-width: 0px; c=
olor: rgb(0, 0, 0); font-family: &amp;quot;Arial&amp;quot;,&amp;quot;Helvet=
ica&amp;quot;,sans-serif; font-size: 13px; font-style: normal; font-variant=
: normal; font-weight: 400; letter-spacing: normal; margin-bottom: 0px; mar=
gin-left: 0px; margin-right: 0px; margin-top: 0px; orphans: 2; padding-bott=
om: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-alig=
n: left; text-decoration: none; text-indent: 0px; text-transform: none; -we=
bkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"><br s=
tyle=3D"border-bottom-color: rgb(0, 0, 0); border-bottom-style: none; borde=
r-bottom-width: 0px; border-image-outset: 0; border-image-repeat: stretch; =
border-image-slice: 100%; border-image-source: none; border-image-width: 1;=
 border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-widt=
h: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-=
right-width: 0px; border-top-color: rgb(0, 0, 0); border-top-style: none; b=
order-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0=
px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right:=
 0px; padding-top: 0px;"></span><font face=3D"courier new,monospace">class =
FloatImage : public CudaImage&lt;float&gt; { /*using =E2=80=A6*/ };</font><=
/div><div><b></b><i></i><u></u><sub></sub><sup></sup><strike></strike><font=
 face=3D"courier new,monospace"></font><br></div><div><br></div>On Friday, =
June 29, 2018 at 10:56:26 AM UTC+3, Bengt Gustafsson wrote:<blockquote clas=
s=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #c=
cc solid;padding-left: 1ex;"><div dir=3D"ltr">A forward declaration of a cl=
ass name is currently not allowed to be resolved by a type alias of a class=
 template. I don&#39;t see the logic to this, why is this illegal:<div><br>=
</div><div><div><div><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:#800">// forward declaration in one =
header file.</span><span style=3D"color:#000"><br></span><span style=3D"col=
or:#008">class</span><span style=3D"color:#000"> </span><span style=3D"colo=
r:#606">FloatImage</span><span style=3D"color:#660">;</span><span style=3D"=
color:#000"><br><br><br></span><span style=3D"color:#800">// Definition in =
another header file.</span><span style=3D"color:#000"><br></span><span styl=
e=3D"color:#008">template</span><span style=3D"color:#660">&lt;</span><span=
 style=3D"color:#008">typename</span><span style=3D"color:#000"> T</span><s=
pan style=3D"color:#660">&gt;</span><span style=3D"color:#000"> </span><spa=
n style=3D"color:#008">class</span><span style=3D"color:#000"> </span><span=
 style=3D"color:#606">CudaImage</span><span style=3D"color:#000"> </span><s=
pan style=3D"color:#660">{</span><span style=3D"color:#000"><br></span><spa=
n style=3D"color:#660">};</span><span style=3D"color:#000"><br><br></span><=
span style=3D"color:#008">using</span><span style=3D"color:#000"> </span><s=
pan style=3D"color:#606">FloatImage</span><span style=3D"color:#000"> </spa=
n><span style=3D"color:#660">=3D</span><span style=3D"color:#000"> </span><=
span style=3D"color:#606">CudaImage</span><span style=3D"color:#080">&lt;fl=
oat&gt;</span><span style=3D"color:#660">;</span><span style=3D"color:#000"=
><br></span></div></code></div><br><br>Godbolt:=C2=A0<a onmousedown=3D"this=
..href=3D&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgodbolt.org%2Fg%=
2FmmTTeQ\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGG_TM3xx2LQXaJgPxoHe9hGxPK=
Wg&#39;;return true;" onclick=3D"this.href=3D&#39;https://www.google.com/ur=
l?q\x3dhttps%3A%2F%2Fgodbolt.org%2Fg%2FmmTTeQ\x26sa\x3dD\x26sntz\x3d1\x26us=
g\x3dAFQjCNGG_TM3xx2LQXaJgPxoHe9hGxPKWg&#39;;return true;" href=3D"https://=
godbolt.org/g/mmTTeQ" target=3D"_blank" rel=3D"nofollow">https://godbolt.or=
g/<wbr>g/mmTTeQ</a> shows that all compilers reject this.</div><div><br></d=
iv><div>This has=C2=A0 created a fair amount of trouble for me when trying =
to refactor what was previously a FloatImage class to a generic pixel type =
template. I don&#39;t see the logic to making this</div><div>illegal as Flo=
atImage is still the name of a class, i.e. an instance of the CudaImage cla=
ss template.</div><div><br></div><div>While I can update the forward declar=
ation to:</div><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:#800">// forward declaration in one header=
 file.</span><span style=3D"color:#000"><br></span><span style=3D"color:#00=
8">template</span><span style=3D"color:#660">&lt;</span><span style=3D"colo=
r:#008">typename</span><span style=3D"color:#000"> T</span><span style=3D"c=
olor:#660">&gt;</span><span style=3D"color:#000"> </span><span style=3D"col=
or:#008">class</span><span style=3D"color:#000"> </span><span style=3D"colo=
r:#606">CudaImage</span><span style=3D"color:#660">;</span><span style=3D"c=
olor:#000"><br></span><span style=3D"color:#008">using</span><span style=3D=
"color:#000"> </span><span style=3D"color:#606">FloatImage</span><span styl=
e=3D"color:#000"> </span><span style=3D"color:#660">=3D</span><span style=
=3D"color:#000"> </span><span style=3D"color:#606">CudaImage</span><span st=
yle=3D"color:#080">&lt;float&gt;</span><span style=3D"color:#660">;</span><=
span style=3D"color:#000"><br></span></div></code></div><div><div><br>This =
seems to be an unnecessary leakage of implementation detail.</div><div><br>=
</div><div>so is there a technical reason preventing this from being allowe=
d or is it just an oversight that could be corrected?</div><div><br></div><=
/div></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&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 />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/975ab4cd-2ff0-4a09-9fac-7c37dc67cf16%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/975ab4cd-2ff0-4a09-9fac-7c37dc67cf16=
%40isocpp.org</a>.<br />

------=_Part_11176_1127489972.1530262106688--

------=_Part_11175_15024228.1530262106687--

.
