220 38833 <27a351d7-05a0-48e3-92e8-1d70fa2c4f25@isocpp.org> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Boris Rasin <rasin.boris@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Defect? Both gcc and clang instantiate
 constructors when guaranteed copy elision is used.
Date: Tue, 26 Jun 2018 10:38:30 -0700 (PDT)
Lines: 74
Approved: news@gmane.org
Message-ID: <27a351d7-05a0-48e3-92e8-1d70fa2c4f25@isocpp.org>
References: <1dade9c8-f42d-4769-a9f0-16233e47327d@isocpp.org>
 <5B32099B.6030407@gmx.net>
 <6aed481d-0d12-4321-b768-dfd146c2148d@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_15983_1696829284.1530034710247"
X-Trace: blaine.gmane.org 1530034585 15120 195.159.176.226 (26 Jun 2018 17:36:25 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Tue, 26 Jun 2018 17:36:25 +0000 (UTC)
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBCYZ5Y77TUDRBFXUZHMQKGQE6I4A2VA@isocpp.org Tue Jun 26 19:36:21 2018
Return-path: <std-proposals+bncBCYZ5Y77TUDRBFXUZHMQKGQE6I4A2VA@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-yb0-f200.google.com ([209.85.213.200])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCYZ5Y77TUDRBFXUZHMQKGQE6I4A2VA@isocpp.org>)
	id 1fXrt6-0003oH-SZ
	for gclcip-std-proposals@m.gmane.org; Tue, 26 Jun 2018 19:36:21 +0200
Original-Received: by mail-yb0-f200.google.com with SMTP id f22-v6sf13133712ybg.8
        for <gclcip-std-proposals@m.gmane.org>; Tue, 26 Jun 2018 10:38:32 -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=ZuVDMH73y5PTbqnCWxcQ3lKhqR/MYlt2ZiUE/kf5JyE=;
        b=MvRdIMcjsSymMaLkp4s/hUO//V4QSMyGMgANYos3LQRqoLEuq8v5eCmND3QFecb8FO
         8k7LCgi9ps54S90kVpu398cxuVkv15qsFC0cTrlljmt2xkvV1i91M30xPjJ3iUIQ4r4E
         vCP2uDmmbzQ8WaqH1StiKR+3abNfhxFVd1m3yvI7ltA8jTPc9fbXxx+bGmI48vxTpxzA
         UsEqL3mdvRMWBP8eDNNcDbg09Jub0PF7P5SkRpVMauuojYVG/KmzbZrixrzLg02hDhm5
         7jHq9KaLCl8AWmRbb1jeDYu1I+y8ksyrf96DCQOhWkREZ7LCy7PvDT0c9IZ/IhzHtcEi
         RYDQ==
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=ZuVDMH73y5PTbqnCWxcQ3lKhqR/MYlt2ZiUE/kf5JyE=;
        b=CsI0dIc46EdfifhXMyYLI0xzkY0BhtsyM0ML2pn7Y0jn2c6qZm/gIS8NbTS8GO9C0/
         UF4QUoYqYx+G2yXwyWM48TlygePDmYsdqFUSaAeS1mBsLtTq9XeRk5YBLiUbTlE7KA2m
         IJN89Ce3K7gdnjpc0rqZfNHtvkc5lVnceDmnKw2b5XIwsA6NVROP7tsVyNrpjqPvW1tD
         IychbkV5PzoGicOshBz9qqR1kNGet2LmhzR1a+4JSAvAkphu3i1UanFU8lPH/XPhzOqV
         +xIbOCcaQGRDk+XGB1jsyay4C0+q2g4GCrTNfeGH5co7ke83Wqtmy6ECecr7CIUA2f10
         QP7g==
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=ZuVDMH73y5PTbqnCWxcQ3lKhqR/MYlt2ZiUE/kf5JyE=;
        b=HiFHPBESMoRcE0QNeOhLQVD6E1BEN1HzFHd7+1HIUNuhXuwIzBLOdZ+NBw/IdFOrg+
         36cEQto8+r0e46p1DlDn/wz9dnHoueJo0ckJXLS2lepm/SvLxk00bH+vJvrCf4GDbd7P
         HhYoijxNLSY7j7GgYiJNRbjZV6fY0YmaGFTzccEQBVOGuSQNRxwUpgN6BLB37MGb4SKO
         q+lxK3fgsJWtRkzGumDj+2ijMXLssuOkvKhAz32PuhTejL6qT4oUIeSp4/6AKQeUZy7Y
         EhZDns59JMk5MiKJgS5+R111CS9mkFHZBNeBxCmXY2uUcNKqEYks4wp0wbA/i535jaFD
         zzCA==
X-Gm-Message-State: APt69E2AFGJ4ViGktP+oZReHptAIKqBBdaOw/aLyc//eKJ7uAlj+yKUo
	am3l62NAvbixF69wVW0Av7bEUw==
X-Google-Smtp-Source: AAOMgpcpTZJY7k+12/2DE4MIpdTYtyfugejl+/LwmiIrrpZWH4vwNfD7kJHhHbqvOzF9jnY6j5hIlg==
X-Received: by 2002:a81:414b:: with SMTP id f11-v6mr645160ywk.151.1530034711629;
        Tue, 26 Jun 2018 10:38:31 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 2002:a25:ba83:: with SMTP id s3-v6ls703674ybg.15.gmail; Tue, 26
 Jun 2018 10:38:30 -0700 (PDT)
X-Received: by 2002:a25:5f4a:: with SMTP id h10-v6mr233617ybm.5.1530034710657;
        Tue, 26 Jun 2018 10:38:30 -0700 (PDT)
In-Reply-To: <6aed481d-0d12-4321-b768-dfd146c2148d@isocpp.org>
X-Original-Sender: rasin.boris@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:38833
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/38833>

------=_Part_15983_1696829284.1530034710247
Content-Type: multipart/alternative; 
	boundary="----=_Part_15984_1203660026.1530034710247"

------=_Part_15984_1203660026.1530034710247
Content-Type: text/plain; charset="UTF-8"

I think I got it. Per [temp.inst], all class template member function 
declarations are instantiated when class template is instantiated, it's 
only the definitions that are instantiated on first use. So in the 
following example func1 causes an error, while func2 is fine. Looks like 
clang and gcc are correct here.
<https://timsong-cpp.github.io/cppwp/n4659/temp.inst>

struct B;

template <typename T>
struct A
{
    template <typename X = T>
    using type = typename X::type;

    void func1(type<>);
    void func2() { type<> t; }
};

void test()
{
    A<B> a;
}

-- 
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/27a351d7-05a0-48e3-92e8-1d70fa2c4f25%40isocpp.org.

------=_Part_15984_1203660026.1530034710247
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>I think I got it. Per <a class=3D"abbr_ref" href=3D"h=
ttps://timsong-cpp.github.io/cppwp/n4659/temp.inst">[temp.inst]<span style=
=3D"color: rgb(0, 0, 0);">, all class template member function declarations=
 are instantiated when class template is instantiated, it&#39;s only the de=
finitions that are instantiated on first use. So in the following example f=
unc1 causes an error, while func2 is fine. Looks like clang and gcc are cor=
rect here.<br></span></a></div><div><div><br></div><div>struct B;<br><br>te=
mplate &lt;typename T&gt;<br>struct A<br>{<br>=C2=A0=C2=A0=C2=A0 template &=
lt;typename X =3D T&gt;<br>=C2=A0=C2=A0=C2=A0 using type =3D typename X::ty=
pe;<br><br>=C2=A0=C2=A0=C2=A0 void func1(type&lt;&gt;);<br>=C2=A0=C2=A0=C2=
=A0 void func2() { type&lt;&gt; t; }<br>};<br><br>void test()<br>{<br>=C2=
=A0=C2=A0=C2=A0 A&lt;B&gt; a;<br>}<br><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&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/27a351d7-05a0-48e3-92e8-1d70fa2c4f25%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/27a351d7-05a0-48e3-92e8-1d70fa2c4f25=
%40isocpp.org</a>.<br />

------=_Part_15984_1203660026.1530034710247--

------=_Part_15983_1696829284.1530034710247--

.
