220 38910 <94a61631-75a1-4972-b30b-095e30360f55@isocpp.org> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Nicol Bolas <jmckesson@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 08:41:10 -0700 (PDT)
Lines: 115
Approved: news@gmane.org
Message-ID: <94a61631-75a1-4972-b30b-095e30360f55@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_13432_1928334801.1530286870502"
X-Trace: blaine.gmane.org 1530286750 20761 195.159.176.226 (29 Jun 2018 15:39:10 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Fri, 29 Jun 2018 15:39:10 +0000 (UTC)
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBCEKFTV6ZUMBBF5G3HMQKGQE2GIQTOY@isocpp.org Fri Jun 29 17:39:06 2018
Return-path: <std-proposals+bncBCEKFTV6ZUMBBF5G3HMQKGQE2GIQTOY@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-yw0-f199.google.com ([209.85.161.199])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCEKFTV6ZUMBBF5G3HMQKGQE2GIQTOY@isocpp.org>)
	id 1fYvUC-0005Co-Ly
	for gclcip-std-proposals@m.gmane.org; Fri, 29 Jun 2018 17:39:00 +0200
Original-Received: by mail-yw0-f199.google.com with SMTP id p193-v6sf1351276ywh.7
        for <gclcip-std-proposals@m.gmane.org>; Fri, 29 Jun 2018 08:41:12 -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=kiHUo/Z8P5WNIqE6YStCkFI8QoDBBBSR4sbzqV2Gl54=;
        b=FLl/Rggq3PlTDdWlkXe77AlR4VjBs+whJSBAxoxu6MHjklAuVl3NUdyTYrftvHpv8I
         Tp1KIO0k/rw4gOSxQtrzxprESNLYzXfIiq+9biRR9/1EFJNO7r7YV1Wr1iFgaHeEvSPn
         Tx8bu9x1aF6Xeq3VHrHSlEwXe2V6NiHYEXTQgC51qYcr5LfuMIAbE7fRIzDofwu8KcIr
         WdmvRUmdNYfuAXTGw/z0PbCBVLAi4MM/ZDoPpksn7RACpakogw/zbAJF/Guf/wWmMuDd
         OTawW6Fnt/YFD6EpP17Mo3Gq6M6wt6sMPuPjVR+lYeGqqg28vo5Ry4J3zdGmVg19A0XL
         y0ag==
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=kiHUo/Z8P5WNIqE6YStCkFI8QoDBBBSR4sbzqV2Gl54=;
        b=sQPdcwbQEZikAmEAWyRO6KbCAxsDGtGAsVfD6HgZ4RvA/o8fONuDm0XlqFUS+jTxOU
         fX8XH0nsdbucmdi3vC3TyqMtINVNs5n2bh7DKnbUrbv9L0CeixGs4uz7Tmu49yWu3238
         3WraT8DjMGrStxy0rWQH7NJoOFtJJ5YaUQn6+pnCYs14uWCnZtdOyFgV4EHP9HTQy7Ux
         Zm6soqRcNfvB53tc99+T0uHImX842hkzniv5BSLqVOhphHsqQINAgSkQXIVf+/OsrXpx
         HDtRwm39AfO80cJXGPQCz0M0xCUE/IpAth8V5Qs8QIKThQ9ZfRaexFOts17z5odtSXXr
         uEHA==
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=kiHUo/Z8P5WNIqE6YStCkFI8QoDBBBSR4sbzqV2Gl54=;
        b=sLUlM/ZRCPoQQKKQ5/MpQM+1dMvWAQhAYnP7VuxTp5IXg47IlHjnw/BL4tgdEqcTbU
         LWCwTEvwSYiq7RjQg98+DzB0nP9ppb42Hy63DeH0f6CX0OLv7RCvwWVsc37NlRyPlgD8
         9Hs3IC47EIiDemZmozrkjd30us9Ne8xzeGQ0u5COWYuUVxIrbOiWtpRZshYIgFy8552T
         GS4kEhYWc2ebImFkpUNsdPfBUR3IDKyUUsENYGs43eyAaGW32rJPnIHCWpD9T0c4lv5Y
         YOQ2nCbhk4XLTpu5kG7vYnWdhXgk0jVJwkKipT+QHl7BOaDM+24+a8L6fCPSOyC51fnS
         aGsQ==
X-Gm-Message-State: APt69E1C8lu3B1C92yGrNf5SNIOW4XBMI5V1cMD1VfTi/shHutkvEc0d
	e4QJmlrh67ddIySdTAjSHQoHEA==
X-Google-Smtp-Source: ADUXVKIUECtcwZ+ycAYrGA/8ghHUjIPJK3ky4bb7KAWZgv2v4TBAcbbOjPbFp+g4Tk+HiaaW8oAn7Q==
X-Received: by 2002:a0d:c985:: with SMTP id l127-v6mr4527974ywd.35.1530286872002;
        Fri, 29 Jun 2018 08:41:12 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 2002:a81:a906:: with SMTP id g6-v6ls1757947ywh.22.gmail; Fri, 29
 Jun 2018 08:41:11 -0700 (PDT)
X-Received: by 2002:a81:23d1:: with SMTP id j200-v6mr1388232ywj.0.1530286870961;
        Fri, 29 Jun 2018 08:41:10 -0700 (PDT)
In-Reply-To: <b2fb570b-aadb-423e-9821-025cb447cf60@isocpp.org>
X-Original-Sender: jmckesson@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:38910
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/38910>

------=_Part_13432_1928334801.1530286870502
Content-Type: multipart/alternative; 
	boundary="----=_Part_13433_1843940901.1530286870502"

------=_Part_13433_1843940901.1530286870502
Content-Type: text/plain; charset="UTF-8"



On Friday, June 29, 2018 at 3:56:26 AM UTC-4, Bengt Gustafsson wrote:
>
> A forward declaration of a class name is currently not allowed to be 
> resolved by a type alias of a class template. I don't see the logic to 
> 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 = CudaImage<float>;
>
>
OK, so you want to say that `FloatImage` is a class, then you want to say 
it's a type alias. Does that not seem... incoherent to you?

Is `is_class_v<FloatImage>` supposed to be true or false? After all, you 
could have done `using FloatImage = int;` later on, which would change the 
result. Or you could do `using FloatImage = SomeUnionType;`, which again 
changes the result.

Remember: incomplete types can be used to instantiate a lot of the type 
traits. `class FloatImage` is not the same thing as "hey compiler, there's 
a typename called `FloatImage`, but you can't use it for anything right 
now." If you want to be able to say that, then you need a new kind of type 
name. Right now, types can be complete (meaning the full definition is 
available) or incomplete (meaning that the full definition is not 
available, but we do know *something* about it). You want a third category, 
where we no nothing more than that a name is a type.

-- 
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/94a61631-75a1-4972-b30b-095e30360f55%40isocpp.org.

------=_Part_13433_1843940901.1530286870502
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><br>On Friday, June 29, 2018 at 3:56:26 AM UTC-4, Beng=
t Gustafsson 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">A forward declaration of a class 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"backg=
round-color:rgb(250,250,250);border-color:rgb(187,187,187);border-style:sol=
id;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:#008">class</span><span style=3D"colo=
r:#000"> </span><span style=3D"color:#606">FloatImage</span><span style=3D"=
color:#660">;</span><span style=3D"color:#000"><br><br><br></span><span sty=
le=3D"color:#800">// Definition in another header file.</span><span style=
=3D"color:#000"><br></span><span style=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><span style=3D"color:#660">&gt;</span><s=
pan style=3D"color:#000"> </span><span style=3D"color:#008">class</span><sp=
an style=3D"color:#000"> </span><span style=3D"color:#606">CudaImage</span>=
<span style=3D"color:#000"> </span><span style=3D"color:#660">{</span><span=
 style=3D"color:#000"><br></span><span 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><span style=3D"color:#606">FloatImage</s=
pan><span style=3D"color:#000"> </span><span style=3D"color:#660">=3D</span=
><span style=3D"color:#000"> </span><span style=3D"color:#606">CudaImage</s=
pan><span style=3D"color:#080">&lt;float&gt;</span><span style=3D"color:#66=
0">;</span><span style=3D"color:#000"><br></span></div></code></div><br></d=
iv></div></div></div></blockquote><div><br></div><div>OK, so you want to sa=
y that `FloatImage` is a class, then you want to say it&#39;s a type alias.=
 Does that not seem... incoherent to you?</div><div><br></div><div>Is `is_c=
lass_v&lt;FloatImage&gt;` supposed to be true or false? After all, you coul=
d have done `using FloatImage =3D int;` later on, which would change the re=
sult. Or you could do `using FloatImage =3D SomeUnionType;`, which again ch=
anges the result.</div><div><br></div><div>Remember: incomplete types can b=
e used to instantiate a lot of the type traits. `class FloatImage` is not t=
he same thing as &quot;hey compiler, there&#39;s a typename called `FloatIm=
age`, but you can&#39;t use it for anything right now.&quot; If you want to=
 be able to say that, then you need a new kind of type name. Right now, typ=
es can be complete (meaning the full definition is available) or incomplete=
 (meaning that the full definition is not available, but we do know <i>some=
thing</i> about it). You want a third category, where we no nothing more th=
an that a name is a type.<br></div></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/94a61631-75a1-4972-b30b-095e30360f55%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/94a61631-75a1-4972-b30b-095e30360f55=
%40isocpp.org</a>.<br />

------=_Part_13433_1843940901.1530286870502--

------=_Part_13432_1928334801.1530286870502--

.
