This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
[Bug c++/16117] New: filename blocks variable of the same name
- From: "jan.kratochvil at redhat dot com" <sourceware-bugzilla at sourceware dot org>
- To: gdb-prs at sourceware dot org
- Date: Sun, 03 Nov 2013 11:52:50 +0000
- Subject: [Bug c++/16117] New: filename blocks variable of the same name
- Auto-submitted: auto-generated
https://sourceware.org/bugzilla/show_bug.cgi?id=16117
Bug ID: 16117
Summary: filename blocks variable of the same name
Product: gdb
Version: HEAD
Status: NEW
Severity: normal
Priority: P2
Component: c++
Assignee: unassigned at sourceware dot org
Reporter: jan.kratochvil at redhat dot com
Blocks: 16106
Practical example of accidentally using variable "valarray":
# g++ -o reprofull reprofull.C -Wall -g $(pkg-config --cflags --libs
cairomm-1.0)
(gdb) l
1 #include <cairomm/context.h>
2 class C {
3 public:
4 int valarray[1];
5 void m() {} /* line 5 */
6 };
7 int main() {
8 C c;
9 c.m();
10 }
(gdb) b 5
Breakpoint 1 at 0x4006c4: file reprofull.C, line 5.
(gdb) r
Breakpoint 1, C::m (this=0x7fffffffd810) at reprofull.C:5
5 void m() {} /* line 5 */
(gdb) p valarray
A syntax error in expression, near `'.
(gdb) _
Minimal reproducer is:
(gdb) l
1 #include "includefile"
2 class C {
3 public:
4 int includefile[1];
5 void m() {} /* line 5 */
6 };
7 int main() {
8 C c;
9 c.m();
10 }
(gdb) l includefile:1
1 int unusedvar;
(gdb) b 5
(gdb) r
Breakpoint 1, C::m (this=0x7fffffffd810) at repromin.C:5
5 void m() {} /* line 5 */
(gdb) p includefile
A syntax error in expression, near `'.
(gdb) set debug parser 1
(gdb) p includefile
Starting parse
Entering state 0
Reading a token: Next token is token FILENAME ()
Shifting token FILENAME ()
Entering state 46
Reducing stack by rule 101 (line 865):
$1 = token FILENAME ()
-> $$ = nterm block ()
Stack now 0
Entering state 56
Reading a token: Now at end of input.
A syntax error in expression, near `'.
(gdb) _
This can be hit because C++ include files have no .h extension.
--
You are receiving this mail because:
You are on the CC list for the bug.