On Fri, 16 Dec 2016 14:17:32 +0100, Jonathan Wakely wrote:
> On 16/12/16 14:06 +0100, Jan Kratochvil wrote:
> >     (gdb) p bb.c.d
> >     $4 = (D &) @0x601028: {e = 0x601060 <ee>}
> 
> Wat?
> 
> bb.c.d is not a valid expression.
> 
> B::c is a pointer, it should be bb.c->d
> 
> Is it GDB policy to make invalid expressions like that "work"?

Yes, this is a GDB extension from the times of plain C.  In C++ it became
a problem.  That was not the topic of this example for the initial
dereferencing operator.


> I had no idea this even worked, I'd have used bb.c->d.e->i because
> that's the correct expression for accessing that variable.

There was a plan to make the 'compile' project backward compatible with these
confusing GDB universal dot operators.


Jan

Reply via email to