public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/29602] New: cant use typedef class name of a baseclass
@ 2022-09-22 16:06 blarsen at redhat dot com
  2022-09-27 18:12 ` [Bug c++/29602] " keiths at redhat dot com
  2022-10-03 16:04 ` blarsen at redhat dot com
  0 siblings, 2 replies; 3+ messages in thread
From: blarsen at redhat dot com @ 2022-09-22 16:06 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=29602

            Bug ID: 29602
           Summary: cant use typedef class name of a baseclass
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: c++
          Assignee: unassigned at sourceware dot org
          Reporter: blarsen at redhat dot com
  Target Milestone: ---

Consider the following code:
```
class base{
public:
    int x;
};

typedef base tbase;

class derived: public base{
public:
    int y;
};

int main(){
    derived der;
    der.y = 0;
    der.tbase::x = 1;
    return der.tbase::x;
}
```

g++ is able to compile it with no problems, but in GDB I get:
(gdb) 
17          return der.tbase::x;
(gdb) print der.base::x
$1 = 1
(gdb) print der.tbase::x
A syntax error in expression, near `'.

GDB should be able to resolve the typedef in the user expression and find the
correct member.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c++/29602] cant use typedef class name of a baseclass
  2022-09-22 16:06 [Bug c++/29602] New: cant use typedef class name of a baseclass blarsen at redhat dot com
@ 2022-09-27 18:12 ` keiths at redhat dot com
  2022-10-03 16:04 ` blarsen at redhat dot com
  1 sibling, 0 replies; 3+ messages in thread
From: keiths at redhat dot com @ 2022-09-27 18:12 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=29602

Keith Seitz <keiths at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |keiths at redhat dot com

--- Comment #1 from Keith Seitz <keiths at redhat dot com> ---
(In reply to B. Larsen from comment #0)

> g++ is able to compile it with no problems, but in GDB I get:
> (gdb) 
> 17          return der.tbase::x;
> (gdb) print der.base::x
> $1 = 1
> (gdb) print der.tbase::x
> A syntax error in expression, near `'.

I think part of the problem is that the typedef is omitted
from the debuginfo?

Locally:

(gdb) ptype tbase
No symbol "tbase" in current context.

Additionally,

$ readelf -w 29602 | grep tbase
$

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c++/29602] cant use typedef class name of a baseclass
  2022-09-22 16:06 [Bug c++/29602] New: cant use typedef class name of a baseclass blarsen at redhat dot com
  2022-09-27 18:12 ` [Bug c++/29602] " keiths at redhat dot com
@ 2022-10-03 16:04 ` blarsen at redhat dot com
  1 sibling, 0 replies; 3+ messages in thread
From: blarsen at redhat dot com @ 2022-10-03 16:04 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=29602

B. Larsen <blarsen at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |INVALID

--- Comment #2 from B. Larsen <blarsen at redhat dot com> ---
you are correct, and fixing it so the typedef shows up does make GDB work. I
guess this was never a bug after all...

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-10-03 16:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-22 16:06 [Bug c++/29602] New: cant use typedef class name of a baseclass blarsen at redhat dot com
2022-09-27 18:12 ` [Bug c++/29602] " keiths at redhat dot com
2022-10-03 16:04 ` blarsen at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).