[Converted from Gnats 1588] Say we have a type Inner contained in a class or namespace Outer. Then, if you print an expression that refers to Outer::Inner in a situation where the parser needs to know that Outer::Inner is a type (as opposed to some other sort of variable) to disambiguate the parse, you must enclose the name of the type in single quotes. This mainly shows up in casts: if you type (gdb) p (Outer::Inner) foo then GDB will think that the parentheses are used for grouping instead of for a cast, unless you use single quotes; similarly, if you type (gdb) p (Outer::Inner *) foo then GDB will think that the * is used for multiplication instead of as a pointer. (By the time it hits the right parenthesis, it's too late.) This issue is new to GDB 6.1; however, before GDB 6.1, GDB would very rarely get the name of the type right in the first place, thinking it was called "Inner" instead of "Outer::Inner", so the issue didn't arise very frequently. (The only situations that I know of where it did arise were when using GCC 3.3 or later with -gstabs+ in a context where Outer was a class (as opposed to a namespace) and perhaps some situations involving HP's aCC.) Release: 2004-03-17-cvs (or gdb 6.1) Environment: any
From: carlton@sources.redhat.com To: gdb-gnats@sourceware.org Cc: Subject: c++/1588 Date: 17 Mar 2004 20:11:22 -0000 CVSROOT: /cvs/src Module name: src Changes by: carlton@sourceware.org 2004-03-17 20:11:22 Modified files: gdb/testsuite : ChangeLog gdb/testsuite/gdb.cp: classes.exp Log message: 2004-03-17 David Carlton <carlton@kealia.com> * gdb.cp/classes.exp (test_enums): Refer to PR c++/1588 instead of PR c++/826. Patches: http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/testsuite/ChangeLog.diff?cvsroot=src&r1=1.831&r2=1.832 http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.cp/classes.exp.diff?cvsroot=src&r1=1.9&r2=1.10
*** Bug 8922 has been marked as a duplicate of this bug. ***
Subject: Bug 8693 CVSROOT: /cvs/src Module name: src Changes by: tromey@sourceware.org 2010-02-19 20:22:03 Modified files: gdb : ChangeLog c-exp.y cp-namespace.c gdb/testsuite : ChangeLog gdb/testsuite/gdb.cp: namespace.exp Log message: gdb PR c++/8693, PR c++/9496: * cp-namespace.c (cp_lookup_nested_type): Handle TYPE_CODE_UNION. * c-exp.y (lex_one_token): Rename from yylex. Don't call write_dollar_variable. Don't try to classify NAME tokens. (token_and_value): New type. (token_fifo, popping, name_obstack): New globals. (classify_name): New function. (classify_inner_name): Likewise. (yylex): Likewise. (VARIABLE): Now has type sval. (exp : VARIABLE): Call write_dollar_variable. (qualified_name): Use TYPENAME, not typebase. Add production for multiple "::" instances. (variable): Use name_not_typename. (qualified_type): Remove. (typebase): Update. gdb/testsuite PR c++/8693, PR c++/9496: * gdb.cp/namespace.exp: Remove some setup_kfail calls. Added regression tests. Patches: http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/ChangeLog.diff?cvsroot=src&r1=1.11381&r2=1.11382 http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/c-exp.y.diff?cvsroot=src&r1=1.70&r2=1.71 http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/cp-namespace.c.diff?cvsroot=src&r1=1.34&r2=1.35 http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/testsuite/ChangeLog.diff?cvsroot=src&r1=1.2149&r2=1.2150 http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.cp/namespace.exp.diff?cvsroot=src&r1=1.16&r2=1.17
I checked in the fix.