namespace dr100 { template<const char (*)[4]> struct A {}; template<const char (&)[4]> struct B {}; template<const char *> struct C {}; template<const char &> struct D {}; A<&"foo"> a; B<"bar"> b; C<"baz"> c; D<*"quux"> d; #if __cplusplus < 201703L
#else
#endif
}
namespace dr101 { extern "C" void dr101_f();
typedef unsigned size_t;
namespace X {
extern "C" void dr101_f();
typedef unsigned size_t;
}
using X::dr101_f;
using X::size_t;
extern "C" void dr101_f();
typedef unsigned size_t;
}
namespace dr102 { namespace A {
template<typename T> T f(T a, T b) { return a + b; } }
namespace B {
struct S {};
}
B::S operator+(B::S, B::S); template B::S A::f(B::S, B::S); }
namespace dr106 { typedef int &r1;
typedef r1 &r1;
typedef const r1 r1; typedef const r1 &r1;
typedef const int &r2;
typedef r2 &r2;
typedef const r2 r2; typedef const r2 &r2; }
namespace dr107 { struct S {};
extern "C" S operator+(S, S) { return S(); }
}
namespace dr108 { template<typename T> struct A {
struct B { typedef int X; };
B::X x; struct C : B { X x; }; };
template<> struct A<int>::B { int X; };
}
namespace dr109 { struct A { template<typename T> void f(T); };
template<typename T> struct B : T {
using T::template f; using T::template f<int>; using T::f<int>; void g() { this->f<int>(123); } };
}
namespace dr111 { struct A { A(); A(volatile A&, int = 0); A(A&, const char * = "foo"); };
struct B : A { B(); }; const B b1;
B b2(b1); }
namespace dr112 { struct T { int n; };
typedef T Arr[1];
const T a1[1] = {};
volatile T a2[1] = {};
const Arr a3 = {};
volatile Arr a4 = {};
template<const volatile T*> struct X {};
X<a1> x1;
X<a2> x2;
X<a3> x3;
X<a4> x4;
#if __cplusplus < 201103L
#else
#endif
}
namespace dr113 { extern void (*p)();
void f() {
no_such_function(); p();
}
void g();
void (*p)() = &g;
}
namespace dr114 { struct A {
virtual void f(int) = 0; };
struct B : A {
template<typename T> void f(T);
void g() { f(0); }
} b; }
namespace dr115 { template<typename T> int f(T); template<typename T> int g(T); template<typename T> int g(T, int);
int k1 = f(&f); int k2 = f(&f<int>);
int k3 = f(&g<int>);
void h() {
(void)&f; (void)&f<int>;
(void)&g<int>;
&f; &f<int>; &g<int>; }
struct S {
template<typename T> static int f(T);
template<typename T> static int g(T);
template<typename T> static int g(T, int);
} s;
int k4 = f(&s.f); int k5 = f(&s.f<int>);
int k6 = f(&s.g<int>);
void i() {
(void)&s.f; (void)&s.f<int>;
(void)&s.g<int>;
&s.f; &s.f<int>; &s.g<int>; }
struct T {
template<typename T> int f(T);
template<typename T> int g(T);
template<typename T> int g(T, int);
} t;
int k7 = f(&s.f); int k8 = f(&s.f<int>);
int k9 = f(&s.g<int>);
void j() {
(void)&s.f; (void)&s.f<int>;
(void)&s.g<int>;
&s.f; &s.f<int>; &s.g<int>; }
#if __cplusplus >= 201103L
template<typename T=int> void with_default(); int k10 = f(&with_default); int k11 = f(&with_default<>);
void k() {
(void)&with_default; (void)&with_default<>;
&with_default; &with_default<>; }
#endif
}
namespace dr116 { template<int> struct A {};
template<int N> void f(A<N>) {} template<int M> void f(A<M>) {} template<typename T> void f(A<sizeof(T)>) {} template<typename U> void f(A<sizeof(U)>) {} }
namespace dr121 { struct X {
template<typename T> struct Y {};
};
template<typename T> struct Z {
X::Y<T> x;
T::Y<T> y; };
Z<X> z;
}
namespace dr122 { template<typename T> void f();
void g() { f<int>(); }
}
struct dr125_A { struct dr125_B {}; }; dr125_A::dr125_B dr125_C();
namespace dr125_B { dr125_A dr125_C(); }
namespace dr125 {
struct X {
friend dr125_A::dr125_B (::dr125_C)(); friend dr125_A (::dr125_B::dr125_C)(); friend dr125_A::dr125_B::dr125_C(); };
}
namespace dr126 { #if __cplusplus <= 201402L
struct C {};
struct D : C {};
struct E : private C { friend class A; friend class B; };
struct F : protected C {};
struct G : C {};
struct H : D, G {};
struct A {
virtual void cp() throw(C*);
virtual void dp() throw(C*);
virtual void ep() throw(C*); virtual void fp() throw(C*); virtual void gp() throw(C*);
virtual void hp() throw(C*);
virtual void cr() throw(C&);
virtual void dr() throw(C&);
virtual void er() throw(C&); virtual void fr() throw(C&); virtual void gr() throw(C&);
virtual void hr() throw(C&);
virtual void pv() throw(void*);
#if __cplusplus >= 201103L
virtual void np() throw(C*);
virtual void npm() throw(int C::*);
virtual void nr() throw(C*&); virtual void ncr() throw(C*const&);
#endif
virtual void ref1() throw(C *const&);
virtual void ref2() throw(C *);
virtual void v() throw(int);
virtual void w() throw(const int);
virtual void x() throw(int*); virtual void y() throw(const int*);
virtual void z() throw(int); };
struct B : A {
virtual void cp() throw(C*);
virtual void dp() throw(D*);
virtual void ep() throw(E*); virtual void fp() throw(F*); virtual void gp() throw(G*);
virtual void hp() throw(H*);
virtual void cr() throw(C&);
virtual void dr() throw(D&);
virtual void er() throw(E&); virtual void fr() throw(F&); virtual void gr() throw(G&);
virtual void hr() throw(H&);
virtual void pv() throw(C*);
#if __cplusplus >= 201103L
using nullptr_t = decltype(nullptr);
virtual void np() throw(nullptr_t);
virtual void npm() throw(nullptr_t&);
virtual void nr() throw(nullptr_t); virtual void ncr() throw(nullptr_t);
#endif
virtual void ref1() throw(D *const &);
virtual void ref2() throw(D *);
virtual void v() throw(const int);
virtual void w() throw(int);
virtual void x() throw(const int*); virtual void y() throw(int*); virtual void z() throw(long); };
#else
void f() throw(int); #endif
}
namespace dr127 { __extension__ typedef __decltype(sizeof(0)) size_t;
template<typename T> struct A {
A() { throw 0; }
void *operator new(size_t, const char * = 0);
void operator delete(void *, const char *) { T::error; } void operator delete(void *) { T::error; }
};
A<void> *p = new A<void>; A<int> *q = new ("") A<int>; }
namespace dr128 { enum E1 { e1 } x = e1;
enum E2 { e2 } y = static_cast<E2>(x), z = static_cast<E2>(e1);
}
namespace dr131 { const char *a_with_\u0e8c = "\u0e8c";
const char *b_with_\u0e8d = "\u0e8d";
const char *c_with_\u0e8e = "\u0e8e";
}
namespace dr132 { void f() {
extern struct {} x; extern struct S {} y; }
static enum { E } e;
}
namespace dr135 { struct A {
A f(A a) { return a; }
friend A g(A a) { return a; }
static A h(A a) { return a; }
};
}
namespace dr136 { void f(int, int, int = 0); void g(int, int, int); struct A {
friend void f(int, int = 0, int); friend void g(int, int, int = 0); friend void h(int, int, int = 0); friend void i(int, int, int = 0) {} friend void j(int, int, int = 0) {}
operator int();
};
void i(int, int, int); void q() {
j(A(), A()); }
extern "C" void k(int, int, int, int); namespace NSA {
struct A {
friend void dr136::k(int, int, int, int = 0); };
}
namespace NSB {
struct A {
friend void dr136::k(int, int, int = 0, int); };
}
struct B {
void f(int); };
struct C {
friend void B::f(int = 0); };
}
namespace dr137 { extern void *p;
extern const void *cp;
extern volatile void *vp;
extern const volatile void *cvp;
int *q = static_cast<int*>(p);
int *qc = static_cast<int*>(cp); int *qv = static_cast<int*>(vp); int *qcv = static_cast<int*>(cvp); const int *cq = static_cast<const int*>(p);
const int *cqc = static_cast<const int*>(cp);
const int *cqv = static_cast<const int*>(vp); const int *cqcv = static_cast<const int*>(cvp); const volatile int *cvq = static_cast<const volatile int*>(p);
const volatile int *cvqc = static_cast<const volatile int*>(cp);
const volatile int *cvqv = static_cast<const volatile int*>(vp);
const volatile int *cvqcv = static_cast<const volatile int*>(cvp);
}
namespace dr139 { namespace example1 {
typedef int f; struct A {
friend void f(A &); };
}
namespace example2 {
typedef int f;
namespace N {
struct A {
friend void f(A &);
operator int();
void g(A a) { int i = f(a); } };
}
}
}
namespace dr140 { void f(int *const) {} void f(int[3]) {} void g(const int);
void g(int n) { n = 2; }
}
namespace dr141 { template<typename T> void f();
template<typename T> struct S { int n; }; struct A : S<int> {
template<typename T> void f();
template<typename T> struct S {};
} a;
struct B : S<int> {} b;
void g() {
a.f<int>();
(void)a.S<int>::n; #if __cplusplus < 201103L
#endif
b.f<int>(); (void)b.S<int>::n;
}
template<typename T> struct C {
T t;
void g() {
t.f<int>(); }
void h() {
(void)t.S<int>::n; }
void i() {
(void)t.S<int>(); }
};
void h() { C<B>().h(); } struct X {
template<typename T> void S();
};
void i() { C<X>().i(); } }
namespace dr142 { class B { public:
int mi; static int si; };
class D : private B { };
class DD : public D {
void f();
};
void DD::f() {
mi = 3; si = 3; B b_old; dr142::B b;
b.mi = 3;
b.si = 3;
B::si = 3; dr142::B::si = 3;
B *bp1_old = this; dr142::B *bp1 = this; B *bp2_old = (B*)this; dr142::B *bp2 = (dr142::B*)this;
bp2->mi = 3;
}
}
namespace dr143 { namespace A { struct X; }
namespace B { void f(A::X); }
namespace A {
struct X { friend void B::f(X); };
}
void g(A::X x) {
f(x); }
}
namespace dr145 { void f(bool b) {
#if __cplusplus <= 201402L
++b; b++; #else
++b; b++; #endif
}
}
namespace dr147 { namespace example1 {
template<typename> struct A {
template<typename T> A(T);
};
template<> template<> A<int>::A<int>(int) {} template<> template<> A<float>::A(float) {}
}
namespace example2 {
struct A { A(); };
struct B : A { B(); };
A::A a1; B::A a2;
}
namespace example3 {
template<typename> struct A {
template<typename T> A(T);
static A a;
};
template<> A<int>::A<int>(A<int>::a); }
}
namespace dr148 { struct A { int A::*p; };
int check1[__is_pod(int(A::*)) ? 1 : -1];
int check2[__is_pod(A) ? 1 : -1];
}
namespace dr151 { struct X {};
typedef int X::*p;
#if __cplusplus < 201103L
#define fold(x) (__builtin_constant_p(0) ? (x) : (x))
#else
#define fold
#endif
int check[fold(p() == 0) ? 1 : -1];
#undef fold
}
namespace dr152 { struct A {
A(); explicit A(const A&); };
A a1 = A();
#if __cplusplus <= 201402L
#endif
A a2((A()));
A &f();
A a3 = f(); A a4(f());
}
namespace dr154 { union { int a; }; namespace {
union { int b; };
}
static union { int c; };
}
namespace dr155 { struct S { int n; } s = { { 1 } }; }
namespace dr159 { namespace X { void f(); }
void f();
void dr159::f() {} void dr159::X::f() {}
}
namespace dr161 { class A {
protected:
struct B { int n; } b; static B bs;
void f(); static void sf();
};
struct C : A {};
struct D : A {
void g(C c) {
(void)b.n;
B b1;
C::B b2; (void)&C::b; (void)&C::bs;
(void)c.b; (void)c.bs;
f();
sf();
c.f(); c.sf();
A::f();
D::f();
A::sf();
C::sf();
D::sf();
}
};
}
namespace dr162 { struct A {
char &f(char);
static int &f(int);
void g() {
int &a = (&A::f)(0); char &b = (&A::f)('0'); }
};
int &c = (&A::f)(0); char &d = (&A::f)('0'); }
namespace dr164 { void f(int);
template <class T> int g(T t) { return f(t); }
enum E { e };
int f(E);
int k = g(e);
}
namespace dr165 { namespace N {
struct A { friend struct B; };
void f() { void g(); }
}
struct N::B {};
void N::g() {}
}
namespace dr166 { namespace A { class X; }
template<typename T> int f(T t) { return t.n; }
int g(A::X);
template<typename T> int h(T t) { return t.n; } int i(A::X);
namespace A {
class X {
friend int f<X>(X);
friend int dr166::g(X);
friend int h(X);
friend int i(X);
int n; };
int h(X x) { return x.n; }
int i(X x) { return x.n; }
}
template int f(A::X);
int g(A::X x) { return x.n; }
template int h(A::X); int i(A::X x) { return x.n; } }
namespace dr168 { extern "C" typedef int (*p)();
extern "C++" typedef int (*q)();
struct S {
static int f();
};
p a = &S::f; q b = &S::f;
}
namespace dr169 { template<typename> struct A { int n; };
struct B {
template<typename> struct C;
template<typename> void f();
template<typename> static int n; };
struct D : A<int>, B {
using A<int>::n;
using B::C<int>; using B::f<int>; using B::n<int>; };
}
namespace { int dr171a;
}
int dr171b; namespace dr171 {
extern "C" void dr171a();
extern "C" void dr171b(); }
namespace dr172 { enum { zero };
int check1[-1 < zero ? 1 : -1];
enum { x = -1, y = (unsigned int)-1 };
int check2[sizeof(x) > sizeof(int) ? 1 : -1];
enum { a = (unsigned int)-1 / 2 };
int check3a[sizeof(a) == sizeof(int) ? 1 : -1];
int check3b[-a < 0 ? 1 : -1];
enum { b = (unsigned int)-1 / 2 + 1 };
int check4a[sizeof(b) == sizeof(unsigned int) ? 1 : -1];
int check4b[-b > 0 ? 1 : -1];
enum { c = (unsigned long)-1 / 2 };
int check5a[sizeof(c) == sizeof(long) ? 1 : -1];
int check5b[-c < 0 ? 1 : -1];
enum { d = (unsigned long)-1 / 2 + 1 };
int check6a[sizeof(d) == sizeof(unsigned long) ? 1 : -1];
int check6b[-d > 0 ? 1 : -1];
enum { e = (unsigned long long)-1 / 2 }; int check7a[sizeof(e) == sizeof(long) ? 1 : -1]; int check7b[-e < 0 ? 1 : -1];
enum { f = (unsigned long long)-1 / 2 + 1 }; int check8a[sizeof(f) == sizeof(unsigned long) ? 1 : -1]; int check8b[-f > 0 ? 1 : -1];
}
namespace dr173 { int check[('0' + 1 == '1' && '0' + 2 == '2' && '0' + 3 == '3' &&
'0' + 4 == '4' && '0' + 5 == '5' && '0' + 6 == '6' &&
'0' + 7 == '7' && '0' + 8 == '8' && '0' + 9 == '9') ? 1 : -1];
}
namespace dr175 { struct A {}; struct B : private A {}; struct C : B {
A a; dr175::A b;
};
}
namespace dr176 { template<typename T> class Y;
template<> class Y<int> {
void f() {
typedef Y A; typedef Y<char> A; }
};
template<typename T> struct Base {}; template<typename T> struct Derived : public Base<T> {
void f() {
typedef typename Derived::template Base<T> A;
typedef typename Derived::Base A;
}
};
template struct Derived<int>;
template<typename T> struct Derived2 : Base<int>, Base<char> {
typename Derived2::Base b; typename Derived2::Base<double> d;
};
template<typename T> class X { X *p1;
X<T> *p2;
X<int> *p3;
dr176::X *p4; };
}
namespace dr177 { struct B {};
struct A {
A(A &); A(const B &); };
B b;
A a = b;
#if __cplusplus <= 201402L
#endif
struct C { C(C&); }; struct D : C {};
struct E { operator D(); };
E e;
C c = e; }
namespace dr178 { int check[int() == 0 ? 1 : -1];
#if __cplusplus >= 201103L
static_assert(int{} == 0, "");
struct S { int a, b; };
static_assert(S{1}.b == 0, "");
struct T { constexpr T() : n() {} int n; };
static_assert(T().n == 0, "");
struct U : S { constexpr U() : S() {} };
static_assert(U().b == 0, "");
#endif
}
namespace dr179 { void f();
int n = &f - &f; }
namespace dr180 { template<typename T> struct X : T, T::some_base {
X() : T::some_type_that_might_be_T(), T::some_base() {}
friend class T::some_class;
void f() {
enum T::some_enum e;
}
};
}
namespace dr181 { namespace X {
template <template X<class T> > struct A { }; template <template X<class T> > void f(A<X>) { } }
namespace Y {
template <template <class T> class X> struct A { };
template <template <class T> class X> void f(A<X>) { }
}
}
namespace dr182 { template <class T> struct C {
void f();
void g();
};
template <class T> void C<T>::f() {}
template <class T> void C<T>::g() {}
class A {
class B {};
void f();
};
template void C<A::B>::f();
template <> void C<A::B>::g();
void A::f() {
C<B> cb;
cb.f();
}
}
namespace dr183 { template<typename T> struct A {};
template<typename T> struct B {
typedef int X;
};
template<> struct A<int> {
#if __cplusplus <= 199711
typename B<int>::X x; #else
typename B<int>::X x;
#endif
};
}
namespace dr184 { template<typename T = float> struct B {};
template<template<typename TT = float> class T> struct A {
void f();
void g();
};
template<template<typename TT> class T> void A<T>::f() { T<> t; }
template<template<typename TT = char> class T> void A<T>::g() {
T<> t;
typedef T<> X;
typedef T<char> X;
}
void h() { A<B>().g(); }
}
namespace dr187 { const int Z = 1;
template<int X = Z, int Z = X> struct A;
typedef A<> T;
typedef A<1, 1> T;
}
namespace dr188 { char c[10];
int check[sizeof(0, c) == 10 ? 1 : -1];
}
namespace dr194 { struct A {
A();
void A(); };
struct B {
void B(); B();
};
struct C {
inline explicit C(int) {}
};
}
namespace dr195 { void f();
int *p = (int*)&f; void (*q)() = (void(*)())&p; }
namespace dr197 { char &f(char);
template <class T> void g(T t) {
char &a = f(1);
char &b = f(T(1)); char &c = f(t); }
void f(int);
enum E { e };
int &f(E);
void h() {
g('a');
g(2);
g(e); }
}
namespace dr198 { struct A {
int n;
struct B {
int m[sizeof(n)];
#if __cplusplus < 201103L
#endif
int f() { return n; }
};
struct C;
struct D;
};
struct A::C {
int m[sizeof(n)];
#if __cplusplus < 201103L
#endif
int f() { return n; }
};
struct A::D : A {
int m[sizeof(n)];
#if __cplusplus < 201103L
#endif
int f() { return n; }
};
}