ultimatepp/uppdev/TestCppParser/test2.in
cxl 1dcaf53354 .uppdev
git-svn-id: svn://ultimatepp.org/upp/trunk@8794 f0d560ea-af0d-0410-9eb7-867de7ffcac7
2015-08-06 19:12:28 +00:00

53 lines
No EOL
969 B
Text

// This is a test of minor C++11 features
template <class T, class U>
class Test {
T a = 10;
U b{123};
};
class Y {
Y& operator=(const Y&) = default; // default copy semantics
Y(const Y&) = default;
};
constexpr int operator|(Flags f1, Flags f2) { return Flags(int(f1)|int(f2)); }
class X {
X(int x) { if (0<x && x<=max) a=x; else throw bad_X(x); }
X() :X{42} { }
X(string s) :X{lexical_cast<int>(s)} { }
// ...
};
struct Point { int x, y; }
union U1 {
int m1;
complex<double> m2; // ok
string m3;
};
alignas(double) unsigned char aligned_array[1024];
double foo(double) noexcept;
struct OverrideFinal {
void Foo() final;
void Bar() override;
};
int override;
int final;
thread_local int ThreadLocal;
void Fn()
{
Test< Test< Test<Point> >, Point> x;
Test<Test<Test<Point>>, Point> y;
int x{7};
foo({123});
int y = foo({123});
long long ll = 9223372036854775807LL;
char* p = nullptr;