C++ Logo

std-proposals

Advanced search

Re: [std-proposals] A type trait for detecting virtual base classes

From: Jason McKesson <jmckesson_at_[hidden]>
Date: Fri, 29 Sep 2023 09:31:55 -0400
On Fri, Sep 29, 2023 at 5:04 AM Giuseppe D'Angelo via Std-Proposals
<std-proposals_at_[hidden]> wrote:
>
> Hello,
>
> As per subject, I'd like to propose std::is_virtual_base_of
> (complementing `is_base_of`). You can find a draft of the proposal here:
>
> https://isocpp.org/files/papers/D2985R0.html
>
> Any feedback is welcome.
>
> Thank you,
> --
> Giuseppe D'Angelo

I don't think the following paragraph is correctly stated:

> Although no implementation seems to document their behavior, on all common ABIs, the conversion of an invalid pointer value towards a virtual base causes UB, while a conversion towards a non-virtual class does not cause any issues (cf. below).

If you're examining unspecified, implementation specific behavior, it
is no longer a matter of UB. The standard defines what is and is not
UB; an implementation cannot. Well, an implementation can explicitly
define something that is said to be "implementation-defined" as UB,
but only through documentation.

Or put simply, generated code doesn't have UB.

Other than that, the proposal seems fine.

Received on 2023-09-29 13:32:05