__extension__ typedef __SIZE_TYPE__ size_t;
void *operator new(size_t); #if __cplusplus > 201402L
namespace std {
enum class align_val_t : size_t {};
}
void *operator new(size_t, std::align_val_t); #endif
namespace dr500 { class D;
class A {
class B;
class C;
friend class D;
};
class A::B {};
class A::C : public A::B {};
class D : public A::B {};
}
namespace dr501 { struct A {
friend void f() {}
void g() {
void (*p)() = &f; }
};
}
namespace dr502 { struct Q {};
template<typename T> struct A {
enum E { e = 1 };
void q1() { f(e); }
void q2() { Q arr[sizeof(E)]; f(arr); }
void q3() { Q arr[e]; f(arr); }
void sanity() { Q arr[1]; f(arr); } };
int f(A<int>::E);
template<int N> int f(Q (&)[N]);
template struct A<int>;
}
namespace dr505 { const char *exts = "\e\(\{\[\%"; const char *unknown = "\Q"; }
namespace dr506 { struct NonPod { ~NonPod(); };
void f(...);
void g(NonPod np) { f(np); } }
namespace dr512 { struct A {
A(int);
};
union U { A a; };
#if __cplusplus < 201103L
#endif
}
namespace dr514 { namespace A { extern int x, y; }
int A::x = y;
}
namespace dr515 {
struct X { int n; };
template<typename T> struct Y : T {
int f() { return X::n; }
};
int k = Y<X>().f();
struct A { int a; };
struct B { void f() { int k = sizeof(A::a); } };
#if __cplusplus < 201103L
#endif
}
namespace dr517 { template<typename T> struct S {};
template<typename T> int v = 0;
template struct S<int*>;
template int v<int*>;
S<char&> s;
int k = v<char&>;
template<typename T> struct S<T*> {};
template<typename T> int v<T*> = 0;
template<typename T> struct S<T&> {};
template<typename T> int v<T&> = 0; }
namespace dr518 { enum E { e, };
#if __cplusplus < 201103L
#endif
}
namespace dr519 { #if __cplusplus >= 201103L
#define fold(x) (__builtin_constant_p(x) ? (x) : (x))
int test[fold((int*)(void*)0) ? -1 : 1];
#undef fold
#endif
}
namespace dr522 { struct S {};
template<typename T> void b1(volatile T &);
template<typename T> void b2(volatile T * const *);
template<typename T> void b2(volatile T * const S::*);
template<typename T> void b2(volatile T * const S::* const *);
template<typename T> void b2a(volatile T *S::* const *);
template<typename T> struct Base {};
struct Derived : Base<int> {};
template<typename T> void b3(Base<T>);
template<typename T> void b3(Base<T> *);
void test(int n, const int cn, int **p, int *S::*pm) {
int *a[3], *S::*am[3];
const Derived cd = Derived();
Derived d[3];
b1(n);
b1(cn);
b2(p);
b2(pm);
b2(a);
b2(am);
b2a(am); b3(d);
b3(cd);
}
}
namespace dr524 { template<typename T> void f(T a, T b) { operator+(a, b); }
struct S {};
void operator+(S, S);
template void f(S, S);
namespace N { struct S {}; }
void operator+(N::S, N::S); template void f(N::S, N::S); }
namespace dr525 { namespace before {
template <class T> struct D { operator T*(); };
void g(D<double> ppp) {
delete ppp;
}
}
namespace after {
template <class T> struct D { typename T::error e; }; void g(D<double> *ppp) {
delete ppp; }
}
}
namespace dr526 { template<int> struct S {};
template<int N> void f1(S<N> s);
template<int N> void f2(S<(N)> s); template<int N> void f3(S<+N> s); template<int N> void g1(int (&)[N]);
template<int N> void g2(int (&)[(N)]); template<int N> void g3(int (&)[+N]);
void test(int (&a)[3], S<3> s) {
f1(s);
f2(s); f3(s); g1(a);
g2(a); g3(a); }
template<int N> struct X {
typedef int type;
X<N>::type v1;
X<(N)>::type v2; X<+N>::type v3; };
}
namespace dr527 { extern struct { int x; } a; static struct { int x; } b;
extern "C" struct { int x; } c;
namespace { extern struct { int x; } d; }
typedef struct { int x; } *P;
struct E { static P e; }; namespace { struct F { static P f; }; }
int ax = a.x, bx = b.x, cx = c.x, dx = d.x, ex = E::e->x, fx = F::f->x;
}
namespace dr530 { template<int*> struct S { enum { N = 1 }; };
template<void(*)()> struct T { enum { N = 1 }; };
int n;
void f();
int a[S<&n>::N];
int b[T<&f>::N];
}
namespace dr531 { namespace good {
template<typename T> struct A {
void f(T) { T::error; }
template<typename U> void g(T, U) { T::error; }
struct B { typename T::error error; };
template<typename U> struct C { typename T::error error; };
static T n;
};
template<typename T> T A<T>::n = T::error;
template<> void A<int>::f(int) {}
template<> template<typename U> void A<int>::g(int, U) {}
template<> struct A<int>::B {};
template<> template<typename U> struct A<int>::C {};
template<> int A<int>::n = 0;
void use(A<int> a) {
a.f(a.n);
a.g(0, 0);
A<int>::B b;
A<int>::C<int> c;
}
template<> struct A<char> {
void f(char);
template<typename U> void g(char, U);
struct B;
template<typename U> struct C;
static char n;
};
void A<char>::f(char) {}
template<typename U> void A<char>::g(char, U) {}
struct A<char>::B {};
template<typename U> struct A<char>::C {};
char A<char>::n = 0;
}
namespace bad {
template<typename T> struct A {
void f(T) { T::error; }
template<typename U> void g(T, U) { T::error; }
struct B { typename T::error error; };
template<typename U> struct C { typename T::error error; }; static T n;
};
template<typename T> T A<T>::n = T::error;
void A<int>::f(int) {} template<typename U> void A<int>::g(int, U) {} struct A<int>::B {}; template<typename U> struct A<int>::C {}; int A<int>::n = 0;
template<> struct A<char> { void f(char);
template<typename U> void g(char, U);
struct B; template<typename U> struct C;
static char n;
};
template<> void A<char>::f(char) {} template<> template<typename U> void A<char>::g(char, U) {} template<> struct A<char>::B {}; template<> template<typename U> struct A<char>::C {}; template<> char A<char>::n = 0; }
namespace nested {
template<typename T> struct A {
template<typename U> struct B;
};
template<> template<typename U> struct A<int>::B {
void f();
void g();
template<typename V> void h();
template<typename V> void i();
};
template<> template<typename U> void A<int>::B<U>::f() {}
template<typename U> void A<int>::B<U>::g() {}
template<> template<typename U> template<typename V> void A<int>::B<U>::h() {}
template<typename U> template<typename V> void A<int>::B<U>::i() {}
template<> template<> void A<int>::B<int>::f() {}
template<> template<> template<typename V> void A<int>::B<int>::h() {}
template<> template<> template<> void A<int>::B<int>::h<int>() {}
template<> void A<int>::B<char>::f() {} template<> template<typename V> void A<int>::B<char>::h() {} }
}
namespace dr532 { struct A { };
template<class T> struct B {
template<class R> int &operator*(R&);
};
template<class T, class R> float &operator*(T&, R&);
void test() {
A a;
B<A> b;
int &ir = b * a;
}
}
namespace dr534 { struct S {};
template<typename T> void operator+(S, T);
template<typename T> void operator+<T*>(S, T*) {} }
namespace dr535 { class X { private: X(const X&); };
struct A {
X x;
template<typename T> A(T&);
};
struct B : A {
X y;
B(volatile A&);
};
extern A a1;
A a2(a1);
extern volatile B b1;
B b2(b1);
void f() { throw a1; }
#if __cplusplus >= 201103L
struct C {
constexpr C() : n(0) {}
template<typename T> constexpr C(T&t) : n(t.n == 0 ? throw 0 : 0) {}
int n;
};
constexpr C c() { return C(); }
constexpr C x = c();
#endif
}
const dr539( const a) { const b; new const; try {} catch (const n) {} try {} catch (const) {} if (const n = 0) {} switch (const n = 0) {} while (const n = 0) {} for (const n = 0; const m = 0; ) {} sizeof(const); struct S {
const n; operator const(); };
#if __cplusplus >= 201103L
int arr[3];
{ for (const n : arr) ; {} } (void) [](const) {}; (void) [](const n) {}; enum E : const {}; using T = const; auto f() -> const; #endif
}
namespace dr540 { typedef int &a;
typedef const a &a; typedef const int &b;
typedef b &b;
typedef const a &c; typedef const b &c; }
namespace dr541 { template<int> struct X { typedef int type; };
template<typename T> struct S {
int f(T);
int g(int);
T g(bool);
int h();
int h(T);
void x() {
X<sizeof(f(0))>::type a; X<sizeof(g(0))>::type b; X<sizeof(h(0))>::type b;
typename X<sizeof(f(0))>::type a;
typename X<sizeof(h(0))>::type b;
}
};
}
namespace dr542 { #if __cplusplus >= 201103L
struct A { A() = delete; int n; };
A a[32] = {};
struct B {
int n;
private:
B() = default;
};
B b[32] = {}; #endif
}
namespace dr543 { struct A {
const int n;
};
A a = A();
#if __cplusplus >= 201103L
#endif
}
namespace dr544 { int *n;
template<class T> struct A { int n; };
template<class T> struct B : A<T> { int get(); };
template<> int B<int>::get() { return n; }
int k = B<int>().get();
}
namespace dr546 { template<typename T> struct A { void f(); };
template struct A<int>;
template<typename T> void A<T>::f() { T::error; }
}
namespace dr547 { template<typename T> struct X;
template<typename T> struct X<T() const> {};
template<typename T, typename C> X<T> f(T C::*) { return X<T>(); }
struct S { void f() const; };
X<void() const> x = f(&S::f);
}
namespace dr548 { template<typename T> struct S {};
template<typename T> void f() {}
template struct dr548::S<int>;
template void dr548::f<int>();
}
namespace dr551 { template<typename T> void f() {}
template inline void f<int>();
#if __cplusplus >= 201103L
#endif
template<typename T> inline void g() {}
template inline void g<int>();
#if __cplusplus >= 201103L
#endif
template<typename T> struct X {
void f() {}
};
template inline void X<int>::f();
#if __cplusplus >= 201103L
#endif
}
namespace dr552 { template<typename T, typename T::U> struct X {};
struct Y { typedef int U; };
X<Y, 0> x;
}
struct dr553_class {
friend void *operator new(size_t, dr553_class);
};
namespace dr553 {
dr553_class c;
void *p = new (c) int;
struct namespace_scope {
friend void *operator new(size_t, namespace_scope); };
}
namespace dr557 { template<typename T> struct S {
friend void f(S<T> *);
friend void g(S<S<T> > *);
};
void x(S<int> *p, S<S<int> > *q) {
f(p);
g(q);
}
}
namespace dr558 { wchar_t a = L'\uD7FF';
wchar_t b = L'\xD7FF';
wchar_t c = L'\uD800'; wchar_t d = L'\xD800';
wchar_t e = L'\uDFFF'; wchar_t f = L'\xDFFF';
wchar_t g = L'\uE000';
wchar_t h = L'\xE000';
}
template<typename> struct dr559 { typedef int T; dr559::T u; };
namespace dr561 { template<typename T> void f(int);
template<typename T> void g(T t) {
f<T>(t);
}
namespace {
struct S {};
template<typename T> static void f(S);
}
void h(S s) {
g(s);
}
}
namespace dr564 { extern "C++" void f(int);
void f(int); extern "C++" { extern int n; }
int n; }
namespace dr565 { namespace N {
template<typename T> int f(T); }
using N::f; template<typename T> int f(T*);
template<typename T> void f(T);
template<typename T, int = 0> int f(T); template<typename T> int f(T, int = 0);
template<typename T> int f(T); }
namespace dr566 { #if __cplusplus >= 201103L
int check[int(-3.99) == -3 ? 1 : -1];
#endif
}
namespace dr568 { struct x { int y; };
class trivial : x {
x y;
public:
int n;
};
int check_trivial[__is_trivial(trivial) ? 1 : -1];
struct std_layout {
std_layout();
std_layout(const std_layout &);
~std_layout();
private:
int n;
};
int check_std_layout[__is_standard_layout(std_layout) ? 1 : -1];
struct aggregate {
int x;
int y;
trivial t;
std_layout sl;
};
aggregate aggr = {};
void f(...);
void g(trivial t) { f(t); }
#if __cplusplus < 201103L
#endif
void jump() {
goto x;
#if __cplusplus < 201103L
#endif
trivial t;
x: ;
}
}
namespace dr569 { ;;;;;
#if __cplusplus < 201103L
#endif
}
namespace dr570 { int n;
int &r = n; int &r = n; }
namespace dr571 { typedef int &ir;
int n;
const ir r = n; }
namespace dr572 { enum E { a = 1, b = 2 };
int check[a + b == 3 ? 1 : -1];
}
namespace dr573 { void *a;
int *b = reinterpret_cast<int*>(a);
void (*c)() = reinterpret_cast<void(*)()>(a);
void *d = reinterpret_cast<void*>(c);
#if __cplusplus < 201103L
#endif
void f() { delete a; } int n = d - a; template<void*> struct S;
template<int*> struct T;
}
namespace dr574 { struct A {
A &operator=(const A&) const; };
struct B {
B &operator=(const B&) volatile; };
#if __cplusplus >= 201103L
struct C {
C &operator=(const C&) &; };
struct D {
D &operator=(const D&) &&; };
void test(C c, D d) {
c = c;
C() = c; d = d; D() = d;
}
#endif
struct Test {
friend A &A::operator=(const A&); friend B &B::operator=(const B&); #if __cplusplus >= 201103L
friend C &C::operator=(const C&); friend D &D::operator=(const D&); #endif
};
}
namespace dr575 { template<typename T, typename U = typename T::type> void a(T); void a(...); template<typename T, typename T::type U = 0> void b(T); void b(...); template<typename T, int U = T::value> void c(T); void c(...); template<typename T> void d(T, int = T::value); void d(...); void x() {
a(0);
b(0);
c(0);
d(0); }
template<typename T = int&> void f(T* = 0); template<typename T = int> void f(T = 0); void g() { f<>(); }
template<typename T> T &h(T *);
template<typename T> T *h(T *);
void *p = h((void*)0);
}
namespace dr576 { typedef void f() {} void f(typedef int n); void f(char c) { typedef int n; }
}
namespace dr577 { typedef void V;
typedef const void CV;
void a(void);
void b(const void); void c(V);
void d(CV); void (*e)(void) = c;
void (*f)(const void); void (*g)(V) = a;
void (*h)(CV); template<typename T> void i(T); template<typename T> void j(void (*)(T)); void k() {
a();
c();
i<void>(); i<const void>(); j<void>(0); j<const void>(0); }
}
namespace dr580 { class C;
struct A { static C c; };
struct B { static C c; };
class C {
C(); ~C();
typedef int I; template<int> struct X;
template<int> friend struct Y;
template<int> void f();
template<int> friend void g();
friend struct A;
};
template<C::I> struct C::X {};
template<C::I> struct Y {};
template<C::I> struct Z {};
struct C2 {
class X {
struct A;
typedef int I;
friend struct A;
};
class Y {
template<X::I> struct A {}; };
};
template<C::I> void C::f() {}
template<C::I> void g() {}
template<C::I> void h() {}
C A::c;
C B::c; }
namespace dr583 { int *p;
bool b1 = p < 0; bool b2 = p > 0; bool b3 = p <= 0; bool b4 = p >= 0; }
namespace dr585 { template<typename> struct T;
struct A {
friend T;
#if __cplusplus <= 201402L
#else
#endif
template<typename U> friend T<U>; };
template<template<typename> class T> struct B {
friend T;
#if __cplusplus <= 201402L
#else
#endif
template<typename U> friend T<U>; };
}
namespace dr587 { template<typename T> void f(bool b, const T x, T y) {
const T *p = &(b ? x : y);
}
struct S {};
template void f(bool, const int, int);
template void f(bool, const S, S);
}
namespace dr588 { struct A { int n; }; template<typename T> int f() {
struct S : A, T { int f() { return n; } } s;
int a = s.f();
int b = s.n; }
struct B { int n; }; int k = f<B>(); }
namespace dr589 { struct B { };
struct D : B { };
D f();
extern const B &b;
bool a;
const B *p = &(a ? f() : b); const B *q = &(a ? D() : b); }
namespace dr590 { template<typename T> struct A {
struct B {
struct C {
A<T>::B::C f(A<T>::B::C); };
};
};
template<typename T> typename A<T>::B::C A<T>::B::C::f(A<T>::B::C) {}
}
namespace dr591 { template<typename T> struct A {
typedef int M;
struct B {
typedef void M;
struct C;
};
};
template<typename T> struct A<T>::B::C : A<T> {
M m; };
}
namespace dr595 { template<class T> struct X {
void f() throw(T) {}
#if __cplusplus > 201402L
#endif
};
struct S {
X<S> xs;
};
}
namespace dr598 { namespace N {
void f(int);
void f(char);
void g(void (*)(int));
void h(void (*)(int));
namespace M {
struct S {};
int &h(void (*)(S));
}
void i(M::S);
void i();
}
int &g(void(*)(char));
int &r = g(N::f);
int &s = h(N::f); int &t = h(N::i);
}
namespace dr599 { typedef int Fn();
struct S { operator void*(); };
struct T { operator Fn*(); };
struct U { operator int*(); operator void*(); }; struct V { operator int*(); operator Fn*(); };
void f(void *p, void (*q)(), S s, T t, U u, V v) {
delete p; delete q; delete s; delete t; delete u; delete v;
}
}