Re: [PATCH] PR59170 make pretty printers check for singular iterators

Jan Kratochvil <[email protected]>
Newsgroups gmane.comp.gcc.patches,gmane.comp.gcc.libstdc++.devel,gmane.comp.gdb.devel
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.