diff options
author | Michael Chastain <mec@google.com> | 2003-08-23 03:55:59 +0000 |
---|---|---|
committer | Michael Chastain <mec@google.com> | 2003-08-23 03:55:59 +0000 |
commit | 1105b7eff4c333814e2f260a4ff3df45057a78a4 (patch) | |
tree | 7cf20e2e8c5617c7de559da699df9c0b3dc813ae /gdb/testsuite/gdb.cp/namespace.cc | |
parent | dd21ace235665bd33a51862fe2293c43224c0e59 (diff) | |
download | gdb-1105b7eff4c333814e2f260a4ff3df45057a78a4.zip gdb-1105b7eff4c333814e2f260a4ff3df45057a78a4.tar.gz gdb-1105b7eff4c333814e2f260a4ff3df45057a78a4.tar.bz2 |
2003-08-22 Michael Chastain <mec@shout.net>
* gdb.cp: New directory.
* gdb.cp/*: Copy from gdb.c++/*.
* gdb.c++/*: Remove.
* Makefile.in: Change gdb.c++ to gdb.cp.
* configure.in: Ditto.
* configure: Regnerate.
Diffstat (limited to 'gdb/testsuite/gdb.cp/namespace.cc')
-rw-r--r-- | gdb/testsuite/gdb.cp/namespace.cc | 163 |
1 files changed, 163 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.cp/namespace.cc b/gdb/testsuite/gdb.cp/namespace.cc new file mode 100644 index 0000000..7b9a173 --- /dev/null +++ b/gdb/testsuite/gdb.cp/namespace.cc @@ -0,0 +1,163 @@ +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; +} + +namespace +{ + int X = 9; + + namespace G + { + int Xg = 10; + } +} + +namespace C +{ + int c = 1; + int shadow = 12; + + namespace + { + int cX = 6; + + namespace F + { + int cXf = 7; + } + } + + namespace C + { + int cc = 2; + } + + namespace D + { + int cd = 3; + int shadow = 13; + + namespace E + { + int cde = 5; + } + + void marker2 (void) + { + // NOTE: carlton/2003-04-23: I'm listing the expressions that I + // plan to have GDB try to print out, just to make sure that the + // compiler and I agree which ones should be legal! It's easy + // to screw up when testing the boundaries of namespace stuff. + c; + //cc; + C::cc; + cd; + E::cde; + shadow; + cX; + F::cXf; + X; + G::Xg; + //cXOtherFile; + //XOtherFile; + + 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(); + + C::D::marker2 (); +} |