Bug 22480

Summary: `ptype` returns `struct` for D classes
Product: gdb Reporter: Basile B. <b2.temp>
Component: dAssignee: Not yet assigned to anyone <unassigned>
Status: UNCONFIRMED ---    
Severity: normal CC: tromey
Priority: P2    
Version: unknown   
Target Milestone: ---   
Host: Target:
Build: Last reconfirmed:

Description Basile B. 2017-11-23 01:13:38 UTC
---
module runnable;
class A {}

void main()
{
    A a;
}
---

`ptype a`


gives

---
type = struct runnable.A {
    <no data fields>
} *
---

which means that there's not the hint required if we must

`print a`

or 

`print *a`

the later syntax is required for a class.
Comment 1 Tom Tromey 2020-02-24 15:17:42 UTC
I think the trailing '*' is probably the hint.

The D language implementation is somewhat incomplete in gdb.
It just uses the C type-printing code -- so what you get is what the
C language code in gdb thinks the type is.

Here it is a pointer to a structure, hence the trailing "*".

Enhancing the D language code is completely possible if you are
interested.  Right now it doesn't seem to be under active development.