From 4f2fd501e4b77fc638deeb04f3d53cfcc26322c9 Mon Sep 17 00:00:00 2001 From: Joe Groff Date: Wed, 14 Apr 2010 15:41:40 -0700 Subject: [PATCH] source file for testing c++ stuff --- extra/alien/cxx/tests/test.cpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 extra/alien/cxx/tests/test.cpp diff --git a/extra/alien/cxx/tests/test.cpp b/extra/alien/cxx/tests/test.cpp new file mode 100644 index 0000000000..d4a69958b9 --- /dev/null +++ b/extra/alien/cxx/tests/test.cpp @@ -0,0 +1,31 @@ +namespace Namespace { + int namespaced(int x, int y) { return x + y; } +} + +double toplevel(double x, double y) { return x + y; } +double toplevel(double x, double y, double z) { return x + y + z; } + +class Class +{ + unsigned x; + + Class(); + Class(unsigned _x); + + unsigned member(unsigned y); + unsigned member(unsigned y) const; + + unsigned static_member(unsigned x, unsigned y); +}; + +Class::Class() : x(42) { } +Class::Class(unsigned _x) : x(_x) { } +unsigned Class::member(unsigned y) { return x += y; } +unsigned Class::member(unsigned y) const { return x + y; } +unsigned Class::static_member(unsigned x, unsigned y) { return Class(x).member(y); } + +template +T templated(T x, T y) { return x + y; } + +template int templated(int x, int y); +template double templated(double x, double y);