220 31702 <5741111.lt9RR1yvSQ@tjmaciei-mobl1> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Thiago Macieira <thiago@macieira.org>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Simplify virtual inheritance rules
Date: Sun, 19 Mar 2017 12:10:31 -0700
Lines: 60
Approved: news@gmane.org
Message-ID: <5741111.lt9RR1yvSQ@tjmaciei-mobl1>
References: <6aa2e439-345e-4f04-8843-f38bb7b825b2@isocpp.org> <2697868.vdYFrBLFDC@tjmaciei-mobl1> <CAFk2RUZW+rW5NsDQGff25eF6Kj1RuMwbhE24y800GE584pdhpg@mail.gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-Trace: blaine.gmane.org 1489950634 31560 195.159.176.226 (19 Mar 2017 19:10:34 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Sun, 19 Mar 2017 19:10:34 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCB4TK757YBRBKVPXPDAKGQE5X5PSJI@isocpp.org Sun Mar 19 20:10:30 2017
Return-path: <std-proposals+bncBCB4TK757YBRBKVPXPDAKGQE5X5PSJI@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+bncBCB4TK757YBRBKVPXPDAKGQE5X5PSJI@isocpp.org>)
	id 1cpgDl-0007g9-Fb
	for gclcip-std-proposals@m.gmane.org; Sun, 19 Mar 2017 20:10:29 +0100
Original-Received: by mail-yw0-f198.google.com with SMTP id p77sf385172306ywg.3
        for <gclcip-std-proposals@m.gmane.org>; Sun, 19 Mar 2017 12:10:35 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=from:to:subject:date:message-id:in-reply-to:references:mime-version
         :content-transfer-encoding:x-original-sender
         :x-original-authentication-results:reply-to:precedence:mailing-list
         :list-id:x-spam-checked-in-group:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=WEzOWsxwGxuxtCUE10HmrT5pUeJRWfovaE/NOs+k9OM=;
        b=Y+oJkXcmHHljG//DYYu54oCy29xhrEHzexnucsb1syx1aEFMHKcjT5cxbPDiCiJ2jS
         D6zF0U+8QZNK5vlB39G4ifuaSMfmQfH2fCstAcULMkydux+wbtsstB/JyaxbNFpy4p3b
         rSexkAjq6pMuFEFW0ThraX/FeleSv2ooqxjziBuQRzi9CA3s3vnWGw23frqtzEfycmPL
         QKwtS+WTFCuW5LuwkQwsRWPsIDbqXp+MHeY1AkNfG6QgyRVJLJ7obayEUgykfD/n/rYC
         34NwKM3Dneo7LUO2RRqlOoG74+cKLPRVqNtqi1Zx7z1nbq/KT/YVKkm5YO6x78IL8eHg
         nFGA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to
         :references:mime-version:content-transfer-encoding:x-original-sender
         :x-original-authentication-results:reply-to:precedence:mailing-list
         :list-id:x-spam-checked-in-group:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=WEzOWsxwGxuxtCUE10HmrT5pUeJRWfovaE/NOs+k9OM=;
        b=KBMgDtbBlfdLJtvSVME6Wu6av0jC61/xWKKlMKLYtTVmc9MR6Gy6s5bRhE9og8sYf7
         VlEve0d8erZaBx2c2O0uyo5NHkxa+TRQq+nOE6GeyA1R0L0wDrX1NPlcniD+8C4iE45r
         +3kNVXcoKcGKwSBTW6vRkiiD1U8fmbq+q0KtnlrsjHhIK0akhMViO97hX5VuDI27g0bd
         rs5U25qfpPSnhiPHDPfh2K6MJHvxvDsUzBlWEmlPjc25pMfzRPuJh/djzMDV1HbxwkCB
         8g0QGjblw4YQWRjgoywMycLnHeLia7PEVZZTHwEFN/XkaNudRL0N9oXWSR2HrAYXzg/B
         5IK 
X-Gm-Message-State: AFeK/H2cnUo7A4C9Xo+7nofVBWkOlnZ2xb1zVevnDtVAoBbStj+rvTPrEEIGrI7HBSdS0Q==
X-Received: by 10.129.101.133 with SMTP id z127mr8574417ywb.148.1489950635239;
        Sun, 19 Mar 2017 12:10:35 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.157.25.33 with SMTP id j33ls2349996ota.21.gmail; Sun, 19 Mar
 2017 12:10:34 -0700 (PDT)
X-Received: by 10.13.200.3 with SMTP id k3mr12416831ywd.157.1489950634259;
        Sun, 19 Mar 2017 12:10:34 -0700 (PDT)
Original-Received: from gondolin.macieira.info (gondolin.macieira.info. [78.47.120.188])
        by mx.google.com with ESMTP id j186si4750506ywd.318.2017.03.19.12.10.34
        for <std-proposals@isocpp.org>;
        Sun, 19 Mar 2017 12:10:34 -0700 (PDT)
Received-SPF: pass (google.com: domain of thiago@macieira.org designates 78.47.120.188 as permitted sender) client-ip=78.47.120.188;
Original-Received: from tjmaciei-mobl1.localnet (unknown [IPv6:2601:1c0:4501:5f9f:ad30:6dbd:5d7:7a4d])
	by gondolin.macieira.info (Postfix) with ESMTPSA id 3F1BA11B62E
	for <std-proposals@isocpp.org>; Sun, 19 Mar 2017 12:10:33 -0700 (PDT)
In-Reply-To: <CAFk2RUZW+rW5NsDQGff25eF6Kj1RuMwbhE24y800GE584pdhpg@mail.gmail.com>
X-Original-Sender: thiago@macieira.org
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of thiago@macieira.org designates 78.47.120.188 as permitted sender) smtp.mailfrom=thiago@macieira.org
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <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:31702
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/31702>

On domingo, 19 de mar=C3=A7o de 2017 11:32:04 PDT Ville Voutilainen wrote:
> On 19 March 2017 at 20:20, Thiago Macieira <thiago@macieira.org> wrote:
> >> Right, so this proposal doesn't produce UB. That leaves the other
> >> compatibility issues.
> >=20
> > Which ones?
>=20
> See a couple of emails ago. The cases where the most-derived class
> doesn't have access to the constructor
> of the virtual base; that makes intentionally ill-formed cases well-forme=
d.

Right. This may have been used in existing code to limit inheritance in a t=
ree=20
to only classes that are explicitly white-listed as friends at some point.

I'm wondering if now allowing this inheritance is a problem.

> > Does it make a difference in behaviour which base class actually called
> > the
> > virtual base's construtor? Is there any situation in which it changes w=
ith
> > this proposal?
>=20
> There may well be cases where the designer of the class hierarchy
> intends to force the authors
> of derived classes to provide a value to be used for initializing the
> virtual base.=20

And in this case, the author of the new class is simply saying "I'll have w=
hat=20
he's having" (the direct base class that includes the virtual base).  I=20
understand that this technique would have been very useful to force a uniqu=
e=20
identifier per class in the hierarchy, but now we're allowing a derived cla=
ss=20
not to override the identifier (or silently forget to).

Do we need a keyword to specifically allow this new functionality?

> It might also be the case
> that that value is an invariant for the hierarchy, although I'm not
> sure whether anyone writes such hierarchies.
> Practically, that means passing 'this' up the hierarchy into the virtual
> base.


--=20
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center

--=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/5741111.lt9RR1yvSQ%40tjmaciei-mobl1.

.
