From 66a55e80fca9c649100a3a1fa11f2069752ec223 Mon Sep 17 00:00:00 2001 From: Daniel Berlin Date: Mon, 12 Jun 2000 01:31:41 +0000 Subject: [PATCH] Forgot a file --- gdb/testsuite/gdb.c++/Makefile.in | 2 +- gdb/testsuite/gdb.c++/namespace.cc | 103 +++++++++++++++++++++++++++++ 2 files changed, 104 insertions(+), 1 deletion(-) create mode 100644 gdb/testsuite/gdb.c++/namespace.cc diff --git a/gdb/testsuite/gdb.c++/Makefile.in b/gdb/testsuite/gdb.c++/Makefile.in index ee8e2635cbf..82672598750 100644 --- a/gdb/testsuite/gdb.c++/Makefile.in +++ b/gdb/testsuite/gdb.c++/Makefile.in @@ -3,7 +3,7 @@ srcdir = @srcdir@ EXECUTABLES = ambiguous annota2 anon-union cplusfuncs cttiadd \ derivation inherit local member-ptr method misc \ - overload ovldbreak ref-typ ref-typ2 templates userdef virtfunc namespace + overload ovldbreak ref-typ ref-typ2 templates userdef virtfunc namespace ref-types all: @echo "Nothing to be done for all..." diff --git a/gdb/testsuite/gdb.c++/namespace.cc b/gdb/testsuite/gdb.c++/namespace.cc new file mode 100644 index 00000000000..7667266c278 --- /dev/null +++ b/gdb/testsuite/gdb.c++/namespace.cc @@ -0,0 +1,103 @@ +namespace AAA { + char c; + int i; + int A_xyzq (int); + char xyzq (char); + class inA { + public: + int xx; + int fum (int); + }; +}; + +int AAA::inA::fum (int i) +{ + return 10 + i; +} + +namespace BBB { + char c; + int i; + int B_xyzq (int); + char xyzq (char); + + namespace CCC { + char xyzq (char); + }; + + class Class { + public: + char xyzq (char); + int dummy; + }; +}; + +int AAA::A_xyzq (int x) +{ + return 2 * x; +} + +char AAA::xyzq (char c) +{ + return 'a'; +} + + +int BBB::B_xyzq (int x) +{ + return 3 * x; +} + +char BBB::xyzq (char c) +{ + return 'b'; +} + +char BBB::CCC::xyzq (char c) +{ + return 'z'; +} + +char BBB::Class::xyzq (char c) +{ + return 'o'; +} + +void marker1(void) +{ + return; +} + + +int main () +{ + using AAA::inA; + char c1; + + using namespace BBB; + + c1 = xyzq ('x'); + c1 = AAA::xyzq ('x'); + c1 = BBB::CCC::xyzq ('m'); + + inA ina; + + ina.xx = 33; + + int y; + + y = AAA::A_xyzq (33); + y += B_xyzq (44); + + BBB::Class cl; + + c1 = cl.xyzq('e'); + + marker1(); + +} + + + + +