Date: Tue, 9 Nov 2021 18:58:39 +0100
On 09/11/2021 18.31, Yongwei Wu wrote:
> On Wed, 10 Nov 2021 at 01:12, Jens Maurer <Jens.Maurer_at_[hidden] <mailto:Jens.Maurer_at_[hidden]>> wrote:
>
> On 09/11/2021 16.49, Yongwei Wu via Std-Discussion wrote:
> > On Tue, 9 Nov 2021 at 23:04, <language.lawyer_at_[hidden] <mailto:language.lawyer_at_[hidden]> <mailto:language.lawyer_at_[hidden] <mailto:language.lawyer_at_[hidden]>>> wrote:
> >
> > On 09/11/2021 17:15, Yongwei Wu wrote:
> > > On Tue, 9 Nov 2021 at 00:11, <language.lawyer_at_[hidden] <mailto:language.lawyer_at_[hidden]> <mailto:language.lawyer_at_[hidden] <mailto:language.lawyer_at_[hidden]>>> wrote:
> > >
> > >> On 08/11/2021 15:32, Yongwei Wu wrote:
>
> > >>> struct B1 { int i1; };
> > >>> struct B2 { int i2; };
> > >>> struct B3 { int i3; };
> > >>>
> > >>> struct D : B1, B2 {};
> > >>>
> > >>> D* pD = …;
> > >>> B2* pB2 = …;
> > >>> B3* pB3 = …;
> > >>>
>
> > Do you know for sure whether modifying *pD by *pB3 is undefined behaviour or not NOW?
>
> struct B3 is totally unrelated to struct D. It is intended that
> you can't use the B3 type to inspect or change anything on a
> D object.
>
>
> I think so too. But which rule forbids that?
At this point, none, which is a defect in the standard.
Jens
> On Wed, 10 Nov 2021 at 01:12, Jens Maurer <Jens.Maurer_at_[hidden] <mailto:Jens.Maurer_at_[hidden]>> wrote:
>
> On 09/11/2021 16.49, Yongwei Wu via Std-Discussion wrote:
> > On Tue, 9 Nov 2021 at 23:04, <language.lawyer_at_[hidden] <mailto:language.lawyer_at_[hidden]> <mailto:language.lawyer_at_[hidden] <mailto:language.lawyer_at_[hidden]>>> wrote:
> >
> > On 09/11/2021 17:15, Yongwei Wu wrote:
> > > On Tue, 9 Nov 2021 at 00:11, <language.lawyer_at_[hidden] <mailto:language.lawyer_at_[hidden]> <mailto:language.lawyer_at_[hidden] <mailto:language.lawyer_at_[hidden]>>> wrote:
> > >
> > >> On 08/11/2021 15:32, Yongwei Wu wrote:
>
> > >>> struct B1 { int i1; };
> > >>> struct B2 { int i2; };
> > >>> struct B3 { int i3; };
> > >>>
> > >>> struct D : B1, B2 {};
> > >>>
> > >>> D* pD = …;
> > >>> B2* pB2 = …;
> > >>> B3* pB3 = …;
> > >>>
>
> > Do you know for sure whether modifying *pD by *pB3 is undefined behaviour or not NOW?
>
> struct B3 is totally unrelated to struct D. It is intended that
> you can't use the B3 type to inspect or change anything on a
> D object.
>
>
> I think so too. But which rule forbids that?
At this point, none, which is a defect in the standard.
Jens
Received on 2021-11-09 11:58:43