summaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.cp/shadow.cc
diff options
context:
space:
mode:
authorSami Wagiaalla <swagiaal@redhat.com>2010-01-26 15:48:25 +0000
committerSami Wagiaalla <swagiaal@redhat.com>2010-01-26 15:48:25 +0000
commit8540c487c665cd07366b3d1fa199af33fa5b3691 (patch)
tree021ae94532f49f553d59058b8a51fd6cfa36c809 /gdb/testsuite/gdb.cp/shadow.cc
parent8f95b6e44955bda4aa330449215785aa987155bb (diff)
downloadbinutils-gdb-8540c487c665cd07366b3d1fa199af33fa5b3691.tar.gz
2010-01-26 Sami Wagiaalla <swagiaal@redhat.com>
* gdb.cp/namespace-using.exp: Add test for printing of namespaces imported into file scope. Marked test as xfail. * gdb.cp/namespace-using.cc (marker5): New function. * gdb.cp/shadow.exp: New test. * gdb.cp/shadow.cc: New test program. * gdb.cp/nsimport.exp: New test. * gdb.cp/nsimport.cc: New test program. 2010-01-26 Sami Wagiaalla <swagiaal@redhat.com> PR gdb/10929: * dwarf2read.c (read_lexical_block_scope): Create blocks for scopes which contain using directives even if they contain no declarations. * symtab.c (lookup_symbol_aux): Pass lowest level block to la_lookup_symbol_nonlocal. * cp-namespace.c (cp_lookup_symbol_nonlocal): call cp_lookup_symbol_namespace. (cp_lookup_symbol_namespace): Perform an import lookup at every block level. (cp_lookup_symbol_imports): New function. (cp_lookup_symbol_in_namespace): New function.
Diffstat (limited to 'gdb/testsuite/gdb.cp/shadow.cc')
-rw-r--r--gdb/testsuite/gdb.cp/shadow.cc45
1 files changed, 45 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.cp/shadow.cc b/gdb/testsuite/gdb.cp/shadow.cc
new file mode 100644
index 00000000000..16515109ab9
--- /dev/null
+++ b/gdb/testsuite/gdb.cp/shadow.cc
@@ -0,0 +1,45 @@
+namespace A
+{
+ int x = 11;
+}
+
+int x = 22;
+int y = 0;
+
+class B
+{
+public:
+ int x;
+
+ int
+ func()
+ {
+ x = 33;
+ y++; // marker1
+
+ {
+ int x = 44;
+ y++; // marker2
+
+ {
+ int x = 55;
+ y++; // marker3
+
+ {
+ using namespace A;
+ y++; // marker4
+
+ using A::x;
+ y++; // marker5
+ }
+ }
+ }
+ }
+};
+
+int
+main()
+{
+ B theB;
+ return theB.func();
+}