public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/12585] New: class name lookup wrong when in constructor
@ 2011-03-15  9:21 andre.poenitz at nokia dot com
  2012-11-21 21:37 ` [Bug c++/12585] " tromey at redhat dot com
  0 siblings, 1 reply; 2+ messages in thread
From: andre.poenitz at nokia dot com @ 2011-03-15  9:21 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=12585

           Summary: class name lookup wrong when in constructor
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned@sourceware.org
        ReportedBy: andre.poenitz@nokia.com


gdb mistakes the name 'foo' within the constructor of a class 'foo' for a
reference to the constructor itself, not as the class name. This makes it
impossible to refer to the type 'foo' in such a location

---------------- snip ----------------
#!/bin/sh

g++ -g -xc++ - <<EOF
struct foo {
    foo() {   // does not happen with s/foo/int bar/ here
        i = 0;
    }
    int i;
};

int main()
{
    foo f;
    return f.i;
}
EOF 

gdb -ex 'set confirm off' \
    -ex 'file a.out' \
    -ex 'start' \
    -ex 'b 4' \
    -ex 'c' \
    -ex 'p this' \
    -ex 'p (foo * const) 0xbfffe520' \
    -ex 'p (int * const) 0xbfffe520' \
    -ex 'p foo ' \
    -ex 'q'
---------------- snip ----------------


produces:

GNU gdb (GDB) 7.2 [...]
This GDB was configured as "i686-pc-linux-gnu". [...]
Temporary breakpoint 1, main () at <stdin>:10
$1 = (foo * const) 0xbfffefdc
A syntax error in expression, near `const) 0xbfffe520'.
$2 = (int * const) 0xbfffe520
$3 = {void (foo *)} 0x80484b0 <foo::foo()>

after replacing the constructor with an ordinary member function int bar()
the result is

$1 = (foo * const) 0xbfffefdc
$2 = (foo * const) 0xbfffe520
$3 = (int * const) 0xbfffe520

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug c++/12585] class name lookup wrong when in constructor
  2011-03-15  9:21 [Bug c++/12585] New: class name lookup wrong when in constructor andre.poenitz at nokia dot com
@ 2012-11-21 21:37 ` tromey at redhat dot com
  0 siblings, 0 replies; 2+ messages in thread
From: tromey at redhat dot com @ 2012-11-21 21:37 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=12585

Tom Tromey <tromey at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |tromey at redhat dot com
         Resolution|                            |DUPLICATE

--- Comment #1 from Tom Tromey <tromey at redhat dot com> 2012-11-21 21:37:23 UTC ---
Duplicate.

*** This bug has been marked as a duplicate of bug 8888 ***

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

end of thread, other threads:[~2012-11-21 21:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-15  9:21 [Bug c++/12585] New: class name lookup wrong when in constructor andre.poenitz at nokia dot com
2012-11-21 21:37 ` [Bug c++/12585] " tromey 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).