namespace std {
struct type_info {};
__extension__ typedef __SIZE_TYPE__ size_t;
}
namespace dr601 { #if __cplusplus >= 201103L
#define MAX __LLONG_MAX__
#else
#define MAX __LONG_MAX__
#endif
#if 0x8000 < -1
#error 0x8000 should be signed
#endif
#if MAX > 0xFFFFFFFF && 0x80000000 < -1
#error 0x80000000 should be signed
#endif
#if __INT_MAX__ == 0x7FFFFFFF
_Static_assert(0x80000000 < -1, "0x80000000 should be unsigned"); #endif
#if MAX > 0xFFFFFFFFFFFFFFFF && 0x8000000000000000 < -1
#error 0x8000000000000000 should be signed
#endif
#if __cplusplus >= 201103L && __LLONG_MAX__ == 0x7FFFFFFFFFFFFFFF
static_assert(0x8000000000000000 < -1, "0x8000000000000000 should be unsigned"); #endif
#undef MAX
}
namespace dr602 { template<class T> struct A {
template<class U> friend struct A;
};
template<class T> struct B {
class C {
template<class U> friend struct B;
typedef int type;
};
typename C::type ct; };
B<int> b;
}
namespace dr603 { template<unsigned char> struct S {};
typedef S<'\001'> S1;
typedef S<(1ul << __CHAR_BIT__) + 1> S1;
#if __cplusplus >= 201103L
#endif
}
namespace dr606 { #if __cplusplus >= 201103L
template<typename T> struct S {};
template<typename T> void f(S<T> &&); template<typename T> void g(T &&);
template<typename T> void h(const T &&);
void test(S<int> s) {
f(s); g(s);
h(s);
g(test);
h(test); }
#endif
}
namespace dr608 { struct A { virtual void f(); };
struct B : A {};
struct C : A { void f(); };
struct D : B, C {};
}
int dr610[-0u == 0u ? 1 : -1];
namespace dr611 { int k;
struct S { int &r; } s = { k ? k : k };
}
namespace dr613 { struct A { int n; static void f(); };
int f(int);
struct B { virtual void f(); };
B &g(int);
int an1 = sizeof(A::n);
int an2 = sizeof(A::n + 1); int an3 = sizeof A::n;
int an4 = sizeof(f(A::n));
int an5 = sizeof(g(A::n));
const std::type_info &an6 = typeid(A::n);
const std::type_info &an7 = typeid(A::n + 1);
const std::type_info &an8 = typeid(f(A::n));
const std::type_info &an9 = typeid(g(A::n)); #if __cplusplus < 201103L
#endif
void A::f() {
int an1 = sizeof n;
const std::type_info &an2 = typeid(n + 1);
#if __cplusplus < 201103L
#endif
const std::type_info &an3 = typeid(g(n)); }
}
int dr614_a[(-1) / 2 == 0 ? 1 : -1]; int dr614_b[(-1) % 2 == -1 ? 1 : -1];
namespace dr615 { int f();
static int n = f();
}
namespace dr616 { #if __cplusplus >= 201103L
struct S { int n; } s;
S f();
using T = decltype((S().n));
using T = decltype((static_cast<S&&>(s).n));
using T = decltype((f().n));
using T = decltype(S().*&S::n);
using T = decltype(static_cast<S&&>(s).*&S::n);
using T = decltype(f().*&S::n);
using T = int&&;
using U = decltype(S().n);
using U = decltype(static_cast<S&&>(s).n);
using U = int;
#endif
}
namespace dr618 { #if (unsigned)-1 > 0
#error wrong
#endif
}
namespace dr619 { extern int x[10];
struct S { static int x[10]; };
int x[];
_Static_assert(sizeof(x) == sizeof(int) * 10, ""); extern int x[];
_Static_assert(sizeof(x) == sizeof(int) * 10, "");
int S::x[];
_Static_assert(sizeof(S::x) == sizeof(int) * 10, "");
void f() {
extern int x[];
sizeof(x); }
}
namespace dr621 {
template<typename T> T f();
template<> int f() {} template<> int f<int>() {} }
namespace dr625 { template<typename T> struct A {};
A<auto> x = A<int>(); void f(int);
void (*p)(auto) = f; }
namespace dr626 { #define STR(x) #x
char c[2] = STR(c); wchar_t w[2] = STR(w); }
namespace dr627 { void f() {
true a = 0; }
}
namespace dr629 { typedef int T;
int n = 1;
void f() {
auto T = 2;
#if __cplusplus < 201103L
#else
#endif
auto T(n);
#if __cplusplus >= 201103L
#endif
}
}
namespace dr630 { const bool MB_EQ_WC =
' ' == L' ' && '\t' == L'\t' && '\v' == L'\v' && '\r' == L'\r' &&
'\n' == L'\n' && 'a' == L'a' && 'b' == L'b' && 'c' == L'c' && 'd' == L'd' && 'e' == L'e' &&
'f' == L'f' && 'g' == L'g' && 'h' == L'h' && 'i' == L'i' && 'j' == L'j' &&
'k' == L'k' && 'l' == L'l' && 'm' == L'm' && 'n' == L'n' && 'o' == L'o' &&
'p' == L'p' && 'q' == L'q' && 'r' == L'r' && 's' == L's' && 't' == L't' &&
'u' == L'u' && 'v' == L'v' && 'w' == L'w' && 'x' == L'x' && 'y' == L'y' &&
'z' == L'z' && 'A' == L'A' && 'B' == L'B' && 'C' == L'C' && 'D' == L'D' && 'E' == L'E' &&
'F' == L'F' && 'G' == L'G' && 'H' == L'H' && 'I' == L'I' && 'J' == L'J' &&
'K' == L'K' && 'L' == L'L' && 'M' == L'M' && 'N' == L'N' && 'O' == L'O' &&
'P' == L'P' && 'Q' == L'Q' && 'R' == L'R' && 'S' == L'S' && 'T' == L'T' &&
'U' == L'U' && 'V' == L'V' && 'W' == L'W' && 'X' == L'X' && 'Y' == L'Y' &&
'Z' == L'Z' && '0' == L'0' && '1' == L'1' && '2' == L'2' && '3' == L'3' && '4' == L'4' &&
'5' == L'5' && '6' == L'6' && '7' == L'7' && '8' == L'8' &&
'9' == L'9' && '_' == L'_' && '{' == L'{' && '}' == L'}' && '[' == L'[' && ']' == L']' &&
'#' == L'#' && '(' == L'(' && ')' == L')' && '<' == L'<' && '>' == L'>' &&
'%' == L'%' && ':' == L':' && ';' == L';' && '.' == L'.' && '?' == L'?' &&
'*' == L'*' && '+' == L'+' && '-' == L'-' && '/' == L'/' && '^' == L'^' &&
'&' == L'&' && '|' == L'|' && '~' == L'~' && '!' == L'!' && '=' == L'=' &&
',' == L',' && '\\' == L'\\' && '"' == L'"' && '\'' == L'\'';
#if __STDC_MB_MIGHT_NEQ_WC__
#ifndef __FreeBSD__
_Static_assert(!MB_EQ_WC, "__STDC_MB_MIGHT_NEQ_WC__ but all basic source characters have same representation"); #endif
#else
_Static_assert(MB_EQ_WC, "!__STDC_MB_MIGHT_NEQ_WC__ but some character differs"); #endif
}
namespace dr632 { struct S { int n; } s = {{5}}; }
namespace dr634 { struct S { S(); S(const S&); virtual void f(); ~S(); };
int f(...);
char f(int);
template<typename T> int (&g(T))[sizeof f(T())];
int (&a)[sizeof(int)] = g(S());
int (&b)[1] = g(0);
int k = f(S()); }
namespace dr635 { template<typename T> struct A { A(); ~A(); };
template<typename T> A<T>::A<T>() {} template<typename T> A<T>::~A<T>() {}
template<typename T> struct B { B(); ~B(); };
template<typename T> B<T>::B() {}
template<typename T> B<T>::~B() {}
struct C { template<typename T> C(); C(); };
template<typename T> C::C() {}
C::C() {}
template<> C::C<int>() {} ;
template<typename T> struct D { template<typename U> D(); D(); };
template<typename T> D<T>::D() {} template<typename T> template<typename U> D<T>::D() {}
template<typename T> D<T>::D<T>() {} }
namespace dr637 { void f(int i) {
i = ++i + 1;
i = i++ + 1;
#if __cplusplus < 201703L
#endif
}
}
namespace dr638 { template<typename T> struct A {
struct B;
void f();
void g();
struct C {
void h();
};
};
class X {
typedef int type;
template<class T> friend struct A<T>::B; template<class T> friend void A<T>::f(); template<class T> friend void A<T>::g(); template<class T> friend void A<T>::C::h(); };
template<> struct A<int> {
X::type a; struct B {
X::type b; };
int f() { X::type c; } void g() { X::type d; } struct D {
void h() { X::type e; } };
};
}
namespace dr639 { void f(int i) {
void((i = 0) + (i = 0)); }
}
namespace dr641 { namespace std_example {
struct abc;
struct xyz {
xyz(); xyz(xyz &);
operator xyz &() = delete; operator abc &() = delete; };
struct abc : xyz {};
template<typename T>
void use(T &); void test() {
use<xyz>(xyz()); use<const xyz>(xyz());
#if __cplusplus < 201103L
#endif
}
}
template<typename T> struct error { typedef typename T::error type; };
struct A {
template<typename T, typename error<T>::type = 0> operator T() const; };
A a;
void f(A&); void g(const A ca) {
f(A()); f(ca); (void)A();
(void)ca;
}
}
namespace dr642 { void f() {
const int i = 2;
{
char i[i];
_Static_assert(sizeof(i) == 2, ""); }
}
struct s { int a; };
void g(int s) {
struct s *p = new struct s;
p->a = s;
}
}
#if __cplusplus >= 201103L
namespace dr643 { struct A {
int x;
auto f() -> decltype(this->x);
auto f(A &a) -> decltype(a.x);
auto g() -> decltype(x);
auto h() -> decltype(this->y); auto h(A &a) -> decltype(a.y); auto i() -> decltype(y); int y;
};
}
#endif
#if __cplusplus >= 201103L
namespace dr644 { struct A {
A() = default;
int x, y;
};
static_assert(__is_literal_type(A), "");
struct B : A {};
static_assert(__is_literal_type(B), "");
struct C : virtual A {};
static_assert(!__is_literal_type(C), "");
struct D { C c; };
static_assert(!__is_literal_type(D), "");
template<typename T>
struct E : T {
constexpr E() = default;
};
static_assert(!__is_literal_type(E<C>), "");
}
#endif
#if __cplusplus >= 201103L
namespace dr646 { struct A {
constexpr A(const A&) = default; };
struct B {
constexpr B() {}
B(B&);
};
constexpr B b = {}; }
#endif
#if __cplusplus >= 201103L
namespace dr647 { struct A {
constexpr virtual void f() const;
constexpr virtual void g() const {}
#if __cplusplus <= 201703L
#endif
};
struct X { virtual void f() const; };
#if __cplusplus <= 201703L
#endif
struct B : X {
constexpr void f() const {}
#if __cplusplus <= 201703L
#endif
};
struct NonLiteral { NonLiteral() {} };
struct C {
constexpr C(NonLiteral);
constexpr C(NonLiteral, int) {} constexpr C() try {} catch (...) {}
#if __cplusplus <= 201703L
#endif
#if __cplusplus < 201402L
#endif
};
struct D {
operator int() const;
constexpr D(int) {}
D(float); };
constexpr int get();
struct E {
int n;
D d;
constexpr E()
: n(D(0)),
d(0) {}
constexpr E(int) : n(0),
d(0.0f) {} constexpr E(float f) : n(get()),
d(D(0) + f) {} };
}
#endif
#if __cplusplus >= 201103L
namespace dr648 { int f();
constexpr int a = (true ? 1 : f());
constexpr int b = false && f();
constexpr int c = true || f();
}
#endif
#if __cplusplus >= 201103L
namespace dr649 { alignas(0x200000000) int n; struct alignas(0x200000000) X {}; struct Y {
int n alignas(0x200000000); };
struct alignas(256) Z {};
auto *p = new Z;
}
#endif
#if __cplusplus >= 201103L
namespace dr651 { struct X {
virtual X &f();
};
struct Y : X {
Y &f();
};
using T = decltype(((X&&)Y()).f());
using T = X &;
}
#endif
#if __cplusplus >= 201103L
namespace dr652 { constexpr int n = 1.2 * 3.4;
static_assert(n == 4, "");
}
#endif
#if __cplusplus >= 201103L
namespace dr654 { void f() {
if (nullptr) {} bool b = nullptr; if (nullptr == 0) {}
if (nullptr != 0) {}
if (nullptr <= 0) {} if (nullptr == 1) {} if (!nullptr) {} decltype(nullptr) n = 0;
static_cast<int>(nullptr); (void)static_cast<decltype(nullptr)>(0);
static_cast<decltype(nullptr)>(1); void(true ? nullptr : 0);
void(true ? 0 : nullptr);
}
}
#endif
namespace dr655 { struct A { A(int); }; struct B : A {
A a; B();
B(int) : B() {} B(int*) : A() {} };
}
namespace dr656 { struct A { A(const A&) = delete; }; struct B : A {};
struct X { operator B(); } x;
const A &r = x;
struct Y : private A { operator B() volatile;
};
extern Y y;
extern volatile Y vy;
const A &s = y; const A &t = vy;
struct C { operator struct D(); } c;
struct D : C {};
const D &d = c;
template<typename T> void accept(T); template<typename T> void accept(...) = delete; void f() {
accept<const A&>(x);
accept<const A&>(y); accept<const A&>(vy); accept<const D&>(c);
}
}
namespace dr657 { struct Abs { virtual void x() = 0; };
struct Der : public Abs { virtual void x(); };
struct Cnvt { template<typename F> Cnvt(F); };
void foo(Cnvt a);
void foo(Abs &a);
void f(Abs *a) { foo(*a); }
void bar(Abs &a);
template<typename T> void bar(T);
void g(Abs *a) { bar(*a); }
struct C { C(Abs) {} };
struct Q { operator Abs() { __builtin_unreachable(); } } q;
#if __cplusplus >= 201703L
C c = Q().operator Abs();
#endif
template<typename F> struct Cnvt2 { Cnvt2(F); typedef int type; };
void baz(Abs &a);
template<typename T> typename Cnvt2<T>::type baz(T);
void h(Abs *a) { baz(*a); }
Cnvt2<Abs>::type err;
}
#if __cplusplus >= 201103L
namespace dr659 { static_assert(alignof(char) == alignof(char&), "");
static_assert(alignof(int) == alignof(int&), "");
int n = alignof(int(&)()); struct A; int m = alignof(A&); }
#endif
#if __cplusplus >= 201103L
namespace dr660 { enum : int { a };
enum class { b }; auto x = a;
struct X {
enum : int { a };
enum class { b }; };
auto y = X::a;
}
#endif
namespace dr662 { template <typename T> void f(T t) {
T &tr = t;
T *tp = &t; #if __cplusplus >= 201103L
auto *ap = &t;
#endif
}
void g(int n) { f<int&>(n); } }
namespace dr663 { int ЍЎ = 123;
}
#if __cplusplus >= 201103L
namespace dr664 { struct A { A(const A&) = delete; };
A &&f(A &&a, int n) {
if (n)
return f(static_cast<A&&>(a), n - 1);
return static_cast<A&&>(a);
}
}
#endif
namespace dr665 { struct A { virtual ~A(); };
struct B : A {} *b;
struct C : private A {} *c; struct D : B, C {} *d;
struct VB : virtual A {} *vb;
struct VC : private virtual A {} *vc; struct VD : VB, VC {} *vd;
void f() {
(void)dynamic_cast<A*>(b);
(void)dynamic_cast<A*>(c); (void)dynamic_cast<A*>(d); (void)dynamic_cast<A*>(vb);
(void)dynamic_cast<A*>(vc); (void)dynamic_cast<A*>(vd);
}
}
namespace dr666 { struct P { friend P operator*(P, P); P(int); } p(0);
template<int> int f();
template<typename T> int f() {
T::type *p = 0; int a(T::type); return f<T::type>(); }
struct X { static const int type = 0; };
struct Y { typedef int type; };
int a = f<X>();
int b = f<Y>(); }
#if __cplusplus >= 201103L
namespace dr667 { struct A {
A() = default; int &r; };
static_assert(!__is_trivially_constructible(A), "");
struct B { ~B() = delete; };
union C { B b; };
static_assert(!__is_trivially_destructible(C), "");
struct D { D(const D&) = delete; };
struct E : D {};
static_assert(!__is_trivially_constructible(E, const E&), "");
struct F { F &operator=(F&&) = delete; };
struct G : F {};
static_assert(!__is_trivially_assignable(G, G&&), "");
}
#endif
#if __cplusplus >= 201103L
namespace dr669 { void f() {
int n;
using T = decltype(n);
using T = int;
using U = decltype((n));
using U = int &;
[=] {
using V = decltype(n);
using V = int;
using W = decltype((n));
using W = const int&;
} ();
struct X {
int n;
void f() const {
using X = decltype(n);
using X = int;
using Y = decltype((n));
using Y = const int&;
}
};
}
}
#endif
namespace dr671 { enum class E { e }; E e = static_cast<E>(0);
int n = static_cast<int>(E::e); int m = static_cast<int>(e); }
namespace dr673 { template<typename> struct X { static const int n = 0; };
class A {
friend class B *f();
class C *f();
void f(class D *);
enum { e = X<struct E>::n };
void g() { extern struct F *p; }
};
B *b;
C *c;
D *d;
E *e;
F *f; }
namespace dr674 { template<typename T> int f(T);
int g(int);
template<typename T> int g(T);
int h(int);
template<typename T> int h(T);
class X {
friend int dr674::f(int);
friend int dr674::g(int);
friend int dr674::h<>(int);
int n; };
template<typename T> int f(T) { return X().n; }
int g(int) { return X().n; }
template<typename T> int g(T) { return X().n; } int h(int) { return X().n; } template<typename T> int h(T) { return X().n; }
template int f(int);
template int g(int); template int h(int);
struct Y {
template<typename T> int f(T);
int g(int);
template<typename T> int g(T);
int h(int);
template<typename T> int h(T);
};
class Z {
friend int Y::f(int);
friend int Y::g(int);
friend int Y::h<>(int);
int n; };
template<typename T> int Y::f(T) { return Z().n; }
int Y::g(int) { return Z().n; }
template<typename T> int Y::g(T) { return Z().n; } int Y::h(int) { return Z().n; } template<typename T> int Y::h(T) { return Z().n; }
template int Y::f<>(int);
template int Y::g<>(int); template int Y::h<>(int);
}
namespace dr675 { template<typename T> struct A { T n : 1; };
#if __cplusplus >= 201103L
static_assert(A<char>{1}.n < 0, "");
static_assert(A<int>{1}.n < 0, "");
static_assert(A<long long>{1}.n < 0, "");
#endif
}
namespace dr677 { struct A {
void *operator new(std::size_t);
void operator delete(void*) = delete; };
struct B {
void *operator new(std::size_t);
void operator delete(void*) = delete; virtual ~B();
};
void f(A *p) { delete p; } void f(B *p) { delete p; } B::~B() {} }
namespace dr679 { struct X {};
template<int> void operator+(X, X);
template<> void operator+<0>(X, X) {} template<> void operator+<0>(X, X) {} }
#if __cplusplus >= 201103L
namespace dr681 { auto *a() -> int; auto (*b)() -> int;
auto (*c()) -> int; auto ((*d)()) -> int;
auto (*e())() -> int;
auto f() -> int (*)();
auto g() -> auto (*)() -> int;
}
#endif
#if __cplusplus >= 201103L
namespace dr683 { struct A {
A() = default;
A(const A&) = default;
A(A&);
};
static_assert(__is_trivially_constructible(A, const A&), "");
static_assert(!__is_trivially_constructible(A, A&), "");
static_assert(!__is_trivial(A), "");
struct B : A {};
static_assert(__is_trivially_constructible(B, const B&), "");
static_assert(__is_trivially_constructible(B, B&), "");
static_assert(__is_trivial(B), "");
}
#endif
#if __cplusplus >= 201103L
namespace dr684 { void f() {
int a; constexpr int *p = &a; }
}
#endif
namespace dr685 { enum E : long { e };
#if __cplusplus < 201103L
#endif
void f(int);
int f(long);
int a = f(e);
enum G : short { g };
#if __cplusplus < 201103L
#endif
int h(short);
void h(long);
int b = h(g);
int i(int);
void i(long);
int c = i(g);
int j(unsigned int); void j(long); int d = j(g);
int k(short);
void k(int);
int x = k(g);
}
namespace dr686 { void f() {
(void)dynamic_cast<struct A*>(0); (void)dynamic_cast<struct A{}*>(0); (void)typeid(struct B*);
(void)typeid(struct B{}*); (void)static_cast<struct C*>(0);
(void)static_cast<struct C{}*>(0); (void)reinterpret_cast<struct D*>(0);
(void)reinterpret_cast<struct D{}*>(0); (void)const_cast<struct E*>(0); (void)const_cast<struct E{}*>(0); (void)sizeof(struct F*);
(void)sizeof(struct F{}*); (void)new struct G*;
(void)new struct G{}*; #if __cplusplus >= 201103L
(void)alignof(struct H*);
(void)alignof(struct H{}*); #endif
(void)(struct I*)0;
(void)(struct I{}*)0; if (struct J *p = 0) {}
if (struct J {} *p = 0) {} for (struct K *p = 0; struct L *q = 0; ) {}
for (struct K {} *p = 0; struct L {} *q = 0; ) {} #if __cplusplus >= 201103L
using M = struct {};
#endif
struct N {
operator struct O{}(){}; };
try {}
catch (struct P *) {} catch (struct P {} *) {} #if __cplusplus < 201703L
void g() throw(struct Q); void h() throw(struct Q {}); #endif
}
template<struct R *> struct X;
template<struct R {} *> struct Y; }
namespace dr687 { template<typename T> void f(T a) {
g<int>(a);
#if __cplusplus <= 201703L
#endif
template g<int>(a); }
}
namespace dr692 { namespace temp_func_order_example2 {
template <typename T, typename U> struct A {};
template <typename T, typename U> void f(U, A<U, T> *p = 0); template <typename U> int &f(U, A<U, U> *p = 0); template <typename T> void g(T, T = T());
template <typename T, typename... U> void g(T, U...); void h() {
int &r = f<int>(42, (A<int, int> *)0);
f<int>(42); g(42);
}
}
namespace temp_func_order_example3 {
template <typename T, typename... U> void f(T, U...); template <typename T> void f(T);
template <typename T, typename... U> int &g(T *, U...); template <typename T> void g(T);
void h(int i) {
f(&i);
int &r = g(&i);
}
}
namespace temp_deduct_partial_example {
template <typename... Args> char &f(Args... args); template <typename T1, typename... Args> short &f(T1 a1, Args... args); template <typename T1, typename T2> int &f(T1 a1, T2 a2);
void g() {
char &a = f();
short &b = f(1, 2, 3);
int &c = f(1, 2);
}
}
namespace temp_deduct_type_example1 {
template <class T1, class ...Z> class S; template <class T1, class ...Z> class S<T1, const Z&...>; template <class T1, class T2> class S<T1, const T2&> {};
S<int, const int&> s;
template<class T, class... U> struct A; template<class T1, class T2, class... U> struct A<T1,T2*,U...>; template<class T1, class T2> struct A<T1,T2> {}; template struct A<int, int*>; }
namespace temp_deduct_type_example3 {
template<class T, class... U> void f(T*, U...){} template<class T> void f(T){} template void f(int*); }
}
namespace dr696 { void f(const int*);
void g() {
const int N = 10; struct A {
void h() {
int arr[N]; (void)arr;
f(&N); }
};
#if __cplusplus >= 201103L
(void) [] { int arr[N]; (void)arr; };
(void)[] { f(&N); }; #endif
}
}