public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "blarsen at redhat dot com" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug c++/29602] New: cant use typedef class name of a baseclass
Date: Thu, 22 Sep 2022 16:06:29 +0000	[thread overview]
Message-ID: <bug-29602-4717@http.sourceware.org/bugzilla/> (raw)

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.

             reply	other threads:[~2022-09-22 16:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-22 16:06 blarsen at redhat dot com [this message]
2022-09-27 18:12 ` [Bug c++/29602] " keiths at redhat dot com
2022-10-03 16:04 ` blarsen at redhat dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-29602-4717@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).