220 31696 <CAFk2RUam2MkSDw_6-=Z+JppmnJ0q=uCc99q0RZ5--U5AqwqBbQ@mail.gmail.com> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Ville Voutilainen <ville.voutilainen@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Simplify virtual inheritance rules
Date: Sun, 19 Mar 2017 15:24:33 +0200
Lines: 58
Approved: news@gmane.org
Message-ID: <CAFk2RUam2MkSDw_6-=Z+JppmnJ0q=uCc99q0RZ5--U5AqwqBbQ@mail.gmail.com>
References: <6aa2e439-345e-4f04-8843-f38bb7b825b2@isocpp.org>
 <CAFk2RUZgeRfv4zYnc+y_Cw1-1onyj-725pq-UUizv8GVm8KQCQ@mail.gmail.com>
 <2340e1b0-09bd-4f5b-bf15-7605eaed858b@isocpp.org> <CAFk2RUZJf0Ls6dD3EE4eSTUiEET7Caa_2h2S4O7YWbBAeYP9xg@mail.gmail.com>
 <b16cfa2e-0aea-45c3-a822-87e196a10ddb@isocpp.org> <25e054ca-aac4-4bcc-805a-4e1357de4f37@isocpp.org>
 <CAFk2RUZNBo6oE9M4uZbN97yCDHwsvj_zKN0qV8EAX=wmQTX9Xw@mail.gmail.com>
 <633f2640-aef5-46a2-9ae2-6db626bc47fb@isocpp.org> <CAFk2RUY=9O-6=h7XYt+0Xg_GOxfrhwwC-vs8mSKexAtbJ6M-mw@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
X-Trace: blaine.gmane.org 1489929875 2431 195.159.176.226 (19 Mar 2017 13:24:35 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Sun, 19 Mar 2017 13:24:35 +0000 (UTC)
To: "ISO C++ Standard - Future Proposals" <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBC5JHI7A7ALRBEUNXLDAKGQEMSBRTAI@isocpp.org Sun Mar 19 14:24:31 2017
Return-path: <std-proposals+bncBC5JHI7A7ALRBEUNXLDAKGQEMSBRTAI@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-yw0-f197.google.com ([209.85.161.197])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBC5JHI7A7ALRBEUNXLDAKGQEMSBRTAI@isocpp.org>)
	id 1cpaov-0008QB-1z
	for gclcip-std-proposals@m.gmane.org; Sun, 19 Mar 2017 14:24:29 +0100
Original-Received: by mail-yw0-f197.google.com with SMTP id k13sf371225371ywk.2
        for <gclcip-std-proposals@m.gmane.org>; Sun, 19 Mar 2017 06:24:35 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=mime-version:in-reply-to:references:from:date:message-id:subject:to
         :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=AMPolLMGbHNOkIxPb7fi+skAnfM0zLbG3QtriFNond0=;
        b=fBse8T+jSf7NnxKqWN1Hgv5ZHSG1n0QzuT7Qj6dxevyRcoB+SFEznzzKew86e08L+8
         0by9TRBc9PWXEqK5Ze7KkDJ2WDRCctXvWnJKwjJfQi+5SUENSPBbs4t4Mo2kG64/wrQx
         WSbUiPXSiqdO7FD6I5ukeMbQb0GPt2vHVEzB2ea6a2lzzlrsgHI4L+75VQ7PgVaBhUrT
         DwJQEYCm+pCsf1f++g07Xy6GgnYQaTmct0j0uUKV6ot/FUl4v0x5WhIOH8EiuY8gigd1
         OEJ5bs0Ac/yHkFGclxjBFpemqhHLSsIF9qrCKONRcMTn+hNfx7Ona9gf+2cgqfiSB2jG
         g4Gg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:mime-version:in-reply-to:references:from:date
         :message-id:subject:to: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=AMPolLMGbHNOkIxPb7fi+skAnfM0zLbG3QtriFNond0=;
        b=ETXCjotqE7jVo4X/D+ZjM8MfYIharDC4OuI5+v05UtOOJD2NyrgyPe3LqU2/VonWjY
         0Gf2b0P1dP7MiH5zAuyXFVyW9D5Kb2NE92A96/LLHWKriqOeDHzOTCI7aB7f3la24fAH
         0ZYv20zVWAyV8WQKaB0vbamxQ51ZefM30wIe2GcEi7fHZoZINVf/oG6mWZ1QqhIX8jVb
         L/RsL1P6cgUOq/2CSMKz4fSAMdBdGEluZE388sohdvhiaVmmrT2yL0qKRSBZL2Sl3YQg
         fPeq5OzY5lcb4rBzAugKvJoQ5wgCabj8IDGzOwnHpYlYX9yCPRrctMazjsaumPAV/5PK
         sl/w==
X-Gm-Message-State: AFeK/H0KSwejq9pvWLzTvz3d7Roke0fNz/pjaCnRk+A7acAAFf9ZgtYv1qd5qIiwLj0p1w==
X-Received: by 10.13.200.3 with SMTP id k3mr11889194ywd.136.1489929874880;
        Sun, 19 Mar 2017 06:24:34 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.157.11.3 with SMTP id a3ls10732519ota.23.gmail; Sun, 19 Mar
 2017 06:24:34 -0700 (PDT)
X-Received: by 10.202.235.214 with SMTP id j205mr2179474oih.209.1489929874306;
        Sun, 19 Mar 2017 06:24:34 -0700 (PDT)
Original-Received: from mail-oi0-x230.google.com (mail-oi0-x230.google.com. [2607:f8b0:4003:c06::230])
        by mx.google.com with ESMTPS id e140si5737415oih.71.2017.03.19.06.24.34
        for <std-proposals@isocpp.org>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Sun, 19 Mar 2017 06:24:34 -0700 (PDT)
Received-SPF: pass (google.com: domain of ville.voutilainen@gmail.com designates 2607:f8b0:4003:c06::230 as permitted sender) client-ip=2607:f8b0:4003:c06::230;
Original-Received: by mail-oi0-x230.google.com with SMTP id a94so12466249oic.2
        for <std-proposals@isocpp.org>; Sun, 19 Mar 2017 06:24:34 -0700 (PDT)
X-Received: by 10.202.58.69 with SMTP id h66mr11514186oia.30.1489929873994;
 Sun, 19 Mar 2017 06:24:33 -0700 (PDT)
Original-Received: by 10.157.13.22 with HTTP; Sun, 19 Mar 2017 06:24:33 -0700 (PDT)
In-Reply-To: <CAFk2RUY=9O-6=h7XYt+0Xg_GOxfrhwwC-vs8mSKexAtbJ6M-mw@mail.gmail.com>
X-Original-Sender: ville.voutilainen@gmail.com
X-Original-Authentication-Results: mx.google.com;       dkim=pass
 header.i=@gmail.com;       spf=pass (google.com: domain of
 ville.voutilainen@gmail.com designates 2607:f8b0:4003:c06::230 as permitted
 sender) smtp.mailfrom=ville.voutilainen@gmail.com;       dmarc=pass (p=NONE
 sp=NONE dis=NONE) header.from=gmail.com
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:31696
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/31696>

On 19 March 2017 at 15:07, Ville Voutilainen
<ville.voutilainen@gmail.com> wrote:
> On 19 March 2017 at 14:55, Denis Kotov <redradist@gmail.com> wrote:
>> Ville Voutilainen,
>>
>> That is the point: We will anyway know that VirtualBase is performed, but by
>> parent class where two VirtualBase (VC class) class inherites in class C3.
>
> There are situations where the bases do not need to initialize the virtual base:
> http://open-std.org/JTC1/SC22/WG21/docs/cwg_defects.html#1611

However, thanks for the clarification, so what we have here is

1) if the intermediate bases are non-abstract, they will have compiled
the virtual base initialization into them
2) therefore the more-derived class wouldn't need to do it

So we don't have a case of UB. We have cases where code that wasn't
previously valid will now be valid,
though:

struct B
{
private:
    B(int) {}
    friend class D;
};

struct D : virtual B // thou shalt not initialize me from a derived class
{
    D() : B(42) {}
};

struct E : D
{
    E() : B(42) {} // this attempt to initialize D is ill-formed
};

int main()
{
    D d; // ok
    E e; // we can't even get this far
}

With your proposal, E could skip the initialization of B and be well-formed.

Another problem with the proposal is that today it's possible to write
class hierarchies that
rely on the most-derived class being the one to initialize the virtual
base. This proposal
changes how such hierarchies behave.

-- 
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/CAFk2RUam2MkSDw_6-%3DZ%2BJppmnJ0q%3DuCc99q0RZ5--U5AqwqBbQ%40mail.gmail.com.

.
