namespace dr300 { template<typename R, typename A> void f(R (&)(A)) {}
int g(int);
void h() { f(g); }
}
namespace dr301 { struct S;
template<typename T> void operator+(T, T);
void operator-(S, S);
void f() {
bool a = (void(*)(S, S))operator+<S> < (void(*)(S, S))operator+<S>;
bool b = (void(*)(S, S))operator- < (void(*)(S, S))operator-; bool c = (void(*)(S, S))operator+ < (void(*)(S, S))operator-; }
template<typename T> void f() {
typename T::template operator+<int> a; class T::template operator+<int> b; enum T::template operator+<int> c; enum T::template operator+<int>::E d; enum T::template X<int>::E e;
T::template operator+<int>::foobar(); T::template operator+<int>(0); }
template<typename T> class operator&<T*> {}; template<typename T> class T::operator& {}; template<typename T> class S::operator&<T*> {}; }
namespace dr302 { struct A { A(); ~A(); };
#if __cplusplus < 201103L
struct B { const int n; A a;
} b = B(); struct C {
const int n;
} c = C();
#else
struct B {
const int n; A a;
} b = B(); struct C {
const int n; } c = C(); struct D {
const int n = 0;
} d = D();
#endif
}
namespace dr304 { typedef int &a;
int n = a();
struct S { int &b; };
int m = S().b;
#if __cplusplus < 201103L
#else
#endif
}
namespace dr305 { struct A {
typedef A C;
};
void f(A *a) {
struct A {};
a->~A();
a->~C();
}
typedef A B;
void g(B *b) {
b->~B();
b->~C();
}
void h(B *b) {
struct B {}; b->~B(); }
template<typename T> struct X {};
void i(X<int>* x) {
struct X {};
x->~X<int>();
x->~X();
x->~X<char>(); }
#if __cplusplus >= 201103L
struct Y {
template<typename T> using T1 = Y;
};
template<typename T> using T2 = Y;
void j(Y *y) {
y->~T1<int>();
y->~T2<int>();
}
struct Z {
template<typename T> using T2 = T;
};
void k(Z *z) {
z->~T1<int>(); z->~T2<int>(); z->~T2<Z>();
}
namespace Q {
template<typename A> struct R {};
}
template<typename A> using R = Q::R<int>;
void qr(Q::R<int> x) { x.~R<char>(); } #endif
}
namespace dr306 { struct A { struct B {}; };
struct C { typedef A::B B; };
struct D : A, A::B, C {};
D::B b;
struct X {}; template<typename T> struct Y { typedef T X; }; template<typename T> struct Z : X, Y<T> {};
Z<X>::X zx;
Z<const X>::X zcx; }
namespace dr308 { struct A {};
struct B : A {};
struct C : A {};
struct D : B, C {};
void f() {
try {
throw D();
} catch (const A&) { } catch (const B&) { }
}
}
namespace dr311 { namespace X { namespace Y {} }
namespace X::Y {}
#if __cplusplus <= 201402L
#endif
namespace X {
namespace X::Y {}
#if __cplusplus <= 201402L
#endif
}
namespace ::dr311::X {} }
namespace dr313 { struct A { operator int() const; };
int *p = new int[A()];
#if __cplusplus < 201103L
#endif
}
namespace dr314 { template<typename T> struct A {
template<typename U> struct B {};
};
template<typename T> struct C : public A<T>::template B<T> {
C() : A<T>::template B<T>() {}
};
}
namespace dr317 { void f() {} inline void f();
int g();
int n = g();
inline int g() { return 0; }
int h();
int m = h();
int h() { return 0; } inline int h(); }
namespace dr318 { struct A {};
struct A::A a;
}
namespace dr319 { typedef struct {
int i;
} *ps;
extern "C" void f(ps);
void g(ps);
static enum { e } a1;
enum { e2 } a2;
enum { n1 = 1u };
typedef int (*pa)[n1];
pa parr;
template<typename> struct X {};
void f() {
struct A { int n; };
extern A a; X<A> xa;
typedef A B;
extern B b; X<B> xb;
const int n = 1;
typedef int (*C)[n];
extern C c; X<C> xc;
}
#if __cplusplus < 201103L
#endif
}
namespace dr320 { #if __cplusplus >= 201103L
struct X {
constexpr X() {}
constexpr X(const X &x) : copies(x.copies + 1) {}
unsigned copies = 0;
};
constexpr X f(X x) { return x; }
constexpr unsigned g(X x) { return x.copies; }
static_assert(f(X()).copies == g(X()) + 1, "expected one extra copy for return value");
#endif
}
namespace dr321 { namespace N {
template<int> struct A {
template<int> struct B;
};
template<> template<> struct A<0>::B<0>;
void f(A<0>::B<0>);
}
template<> template<> struct N::A<0>::B<0> {};
template<typename T> void g(T t) { f(t); }
template void g(N::A<0>::B<0>);
namespace N {
template<typename> struct I { friend bool operator==(const I&, const I&); };
}
N::I<int> i, j;
bool x = i == j;
}
namespace dr322 { struct A {
template<typename T> operator T&();
} a;
int &r = static_cast<int&>(a);
int &s = a;
}
namespace dr324 { struct S { int n : 1; } s; int &a = s.n; int *b = &s.n; int &c = (s.n = 0); int *d = &(s.n = 0); int &e = true ? s.n : s.n; int *f = &(true ? s.n : s.n); int &g = (void(), s.n); int *h = &(void(), s.n); int *i = &++s.n; }
namespace dr326 { struct S {};
int test[__is_trivially_constructible(S, const S&) ? 1 : -1];
}
namespace dr327 { struct A;
class A {};
class B;
struct B {};
}
namespace dr328 { struct A; struct B { A a; }; template<typename> struct C { A a; }; A *p = new A[0]; }
namespace dr329 { struct B {};
template<typename T> struct A : B {
friend void f(A a) { g(a); }
friend void h(A a) { g(a); } friend void i(B b) {} };
A<int> a;
A<char> b;
void test() {
h(a); }
}
namespace dr330 { typedef int *(*P)[3];
typedef const int *const (*Q)[3];
typedef const int *Qinner[3];
typedef Qinner const *Q2; typedef const int *const (*R)[4];
typedef const int *const (*S)[];
typedef const int *(*T)[];
void f(P p, Q q, Q2 q2, R r, S s, T t) {
q = p; q2 = p; r = p; s = p;
#if __cplusplus < 202002
#endif
t = p; s = q;
#if __cplusplus < 202002
#endif
s = q2;
#if __cplusplus < 202002
#endif
s = t; t = s; (void) const_cast<P>(q);
(void) const_cast<P>(q2);
(void) const_cast<Q>(p);
(void) const_cast<Q2>(p);
(void) const_cast<S>(p); (void) const_cast<P>(s); (void) const_cast<S>(q); (void) const_cast<S>(q2); (void) const_cast<Q>(s); (void) const_cast<Q2>(s); (void) const_cast<T>(s);
(void) const_cast<S>(t);
(void) const_cast<T>(q); (void) const_cast<Q>(t);
(void) reinterpret_cast<P>(q); (void) reinterpret_cast<P>(q2); (void) reinterpret_cast<Q>(p);
(void) reinterpret_cast<Q2>(p);
(void) reinterpret_cast<S>(p);
(void) reinterpret_cast<P>(s); (void) reinterpret_cast<S>(q);
(void) reinterpret_cast<S>(q2);
(void) reinterpret_cast<Q>(s);
(void) reinterpret_cast<Q2>(s);
(void) reinterpret_cast<T>(s); (void) reinterpret_cast<S>(t);
(void) reinterpret_cast<T>(q); (void) reinterpret_cast<Q>(t);
}
namespace swift_17882 {
typedef const char P[72];
typedef int *Q;
void f(P &pr, P *pp) {
(void) reinterpret_cast<const Q&>(pr);
(void) reinterpret_cast<const Q*>(pp);
}
struct X {};
typedef const volatile int A[1][2][3];
typedef int *const X::*volatile *B1;
typedef int *const X::* *B2;
typedef int *X::* volatile *B3;
typedef volatile int *(*const B4)[4];
void f(A *a) {
(void) reinterpret_cast<B1*>(a);
(void) reinterpret_cast<B2*>(a); (void) reinterpret_cast<B3*>(a); (void) reinterpret_cast<B4*>(a);
}
}
}
namespace dr331 { struct A {
A(volatile A&); } const a, b(a); }
namespace dr332 { void f(volatile void); void g(const void); void h(int n, volatile void); }
namespace dr333 { int n = 0;
int f(int(n));
int g((int(n)));
int h = f(g);
}
namespace dr334 { template<typename T> void f() {
T x;
f((x, 123));
}
struct S {
friend S operator,(S, int);
friend void f(S);
};
template void f<S>();
}
namespace dr336 { namespace Pre {
template<class T1> class A {
template<class T2> class B {
template<class T3> void mf1(T3);
void mf2();
};
};
template<> template<class X> class A<int>::B {};
template<> template<> template<class T> void A<int>::B<double>::mf1(T t) {} template<class Y> template<> void A<Y>::B<double>::mf2() {} }
namespace Post {
template<class T1> class A {
template<class T2> class B {
template<class T3> void mf1(T3);
void mf2();
};
};
template<> template<class X> class A<int>::B {
template<class T> void mf1(T);
};
template<> template<> template<class T> void A<int>::B<double>::mf1(T t) {}
template<class Y> template<> void A<Y>::B<double>::mf2() {} }
}
namespace dr337 { template<typename T> void f(T (*)[1]);
template<typename T> int &f(...);
struct A { virtual ~A() = 0; };
int &r = f<A>(0);
struct B;
int &s = f<B>(0); struct B { virtual ~B() = 0; };
}
namespace dr339 { template <int I> struct A { static const int value = I; };
char xxx(int);
char (&xxx(float))[2];
template<class T> A<sizeof(xxx((T)0))> f(T) {}
void test() {
A<1> a = f(0);
A<2> b = f(0.0f);
A<3> c = f("foo"); }
char f(int);
int f(...);
template <class T> struct conv_int {
static const bool value = sizeof(f(T())) == 1;
};
template <class T> bool conv_int2(A<sizeof(f(T()))> p);
template<typename T> A<sizeof(f(T()))> make_A();
int a[conv_int<char>::value ? 1 : -1];
bool b = conv_int2<char>(A<1>());
A<1> c = make_A<char>();
}
namespace dr340 { struct A { A(int); };
struct B { B(A, A, int); };
int x, y;
B b(A(x), A(y), 3);
}
namespace dr341 { namespace A {
int n;
extern "C" int &dr341_a = n; }
namespace B {
extern "C" int &dr341_a = dr341_a; }
extern "C" void dr341_b(); }
int dr341_a; int dr341_b; int dr341_c; int dr341_d; namespace dr341 {
extern "C" int dr341_c; extern "C" void dr341_d();
namespace A { extern "C" int dr341_e; } namespace B { extern "C" void dr341_e(); } }
namespace dr343 { template<typename T> struct A {
template<typename U> struct B {};
};
template<typename T> struct C : public A<T>::B<T> { C() : A<T>::B<T>() {} };
}
namespace dr344 { struct A { inline virtual ~A(); };
struct B { friend A::~A(); };
}
namespace dr345 { struct A {
struct X {};
int X; };
struct B {
struct X {};
};
template <class T> void f(T t) { typename T::X x; } void f(A a, B b) {
f(b);
f(a); }
}
namespace dr347 { struct base {
struct nested;
static int n;
static void f();
void g();
};
struct derived : base {};
struct derived::nested {}; int derived::n; void derived::f() {} void derived::g() {} }
namespace dr349 { struct A {
template <class T> operator T ***() {
int ***p = 0;
return p; }
};
A a;
const int *const *const *p1 = a;
struct B {
template <class T> operator T ***() {
const int ***p = 0;
return p;
}
};
B b;
const int *const *const *p2 = b;
}
namespace dr352 { namespace example1 {
namespace A {
enum E {};
template<typename R, typename A> void foo(E, R (*)(A)); }
template<typename T> void arg(T);
template<typename T> int arg(T) = delete;
void f(A::E e) {
foo(e, &arg);
using A::foo;
foo<int, int>(e, &arg); }
int arg(int);
void g(A::E e) {
foo(e, &arg);
using A::foo;
foo<int, int>(e, &arg); }
}
namespace contexts {
template<int I> void f1(int (&)[I]);
template<int I> void f2(int (&)[I+1]); template<int I> void f3(int (&)[I+1], int (&)[I]);
void f() {
int a[4];
int b[3];
f1(a);
f2(a); f3(a, b);
}
template<int I> struct S {};
template<int I> void g1(S<I>);
template<int I> void g2(S<I+1>); template<int I> void g3(S<I+1>, S<I>);
void g() {
S<4> a;
S<3> b;
g1(a);
g2(a); g3(a, b);
}
template<typename T> void h1(T = 0); template<typename T> void h2(T, T = 0);
void h() {
h1(); h1(0);
h1<int>();
h2(0);
}
template<typename T> int tmpl(T);
template<typename R, typename A> void i1(R (*)(A)); template<typename R, typename A> void i2(R, A, R (*)(A)); void i() {
extern int single(int);
i1(single);
i2(0, 0, single);
extern int ambig(float), ambig(int);
i1(ambig); i2(0, 0, ambig);
extern void no_match(float), no_match(int);
i1(no_match); i2(0, 0, no_match);
i1(tmpl); i2(0, 0, tmpl);
}
}
template<typename T> struct is_int;
template<> struct is_int<int> {};
namespace example2 {
template<typename T> int f(T (*p)(T)) { is_int<T>(); }
int g(int);
int g(char);
int i = f(g);
}
namespace example3 {
template<typename T> int f(T, T (*p)(T)) { is_int<T>(); }
int g(int);
char g(char);
int i = f(1, g);
}
namespace example4 {
template <class T> int f(T, T (*p)(T)) { is_int<T>(); }
char g(char);
template <class T> T g(T);
int i = f(1, g);
}
namespace example5 {
template<int I> class A {};
template<int I> void g(A<I+1>); template<int I> void f(A<I>, A<I+1>);
void h(A<1> a1, A<2> a2) {
g(a1); g<0>(a1);
f(a1, a2);
}
}
}
namespace dr354 { struct S {};
template<int*> struct ptr {}; ptr<0> p0;
ptr<(int*)0> p1;
ptr<(float*)0> p2;
ptr<(int S::*)0> p3;
#if __cplusplus < 201103L
#elif __cplusplus <= 201402L
#else
#endif
template<int*> int both();
template<int> int both();
int b0 = both<0>();
int b1 = both<(int*)0>();
#if __cplusplus < 201103L
#endif
template<int S::*> struct ptr_mem {}; ptr_mem<0> m0;
ptr_mem<(int S::*)0> m1;
ptr_mem<(float S::*)0> m2;
ptr_mem<(int *)0> m3;
#if __cplusplus < 201103L
#elif __cplusplus <= 201402L
#else
#endif
}
struct dr355_S; struct ::dr355_S {}; namespace dr355 { struct ::dr355_S s; }
namespace dr357 { template<typename T> struct A {
void f() const; };
template<typename T> void A<T>::f() {}
struct B {
template<typename T> void f();
};
template<typename T> void B::f() const {} }
namespace dr358 { extern "C" void dr358_f();
namespace N {
int var;
extern "C" void dr358_f() { var = 10; }
}
}
namespace dr359 { struct E {
union {
struct {
int x;
} s;
} v;
union {
struct { int x;
} s;
struct S { int x;
} t;
union { int u;
};
};
};
}
namespace dr364 { struct S {
static void f(int);
void f(char);
};
void g() {
S::f('a'); S::f(0);
}
}
#if "foo"
#endif
namespace dr367 { int a[true ? throw 0 : 4]; int b[true ? 4 : throw 0];
int c[true ? *new int : 4]; int d[true ? 4 : *new int];
#if __cplusplus < 201103L
#endif
}
namespace dr368 { template<typename T, T> struct S {}; template<typename T> int f(S<T, T()> *); template<typename T> int g(S<T, (T())> *); template<typename T> int g(S<T, true ? T() : T()> *); struct X {};
int n = g<X>(0); }
namespace dr372 { namespace example1 {
template<typename T> struct X {
protected:
typedef T Type; };
template<typename T> struct Y {};
template<typename T,
template<typename> class T1,
template<typename> class T2> struct Z1 :
T1<T>,
T2<typename T1<T>::Type> {};
template<typename T,
template<typename> class T1,
template<typename> class T2> struct Z2 :
T2<typename T1<T>::Type>, T1<T> {};
Z1<int, X, Y> z1; Z2<int, X, Y> z2; }
namespace example2 {
struct X {
private:
typedef int Type; };
template<typename T> struct A {
typename T::Type t; };
A<X> ax; }
namespace example3 {
struct A {
protected:
typedef int N; };
template<typename T> struct B {};
template<typename U> struct C : U, B<typename U::N> {}; template<typename U> struct D : B<typename U::N>, U {};
C<A> x; D<A> y; }
namespace example4 {
class A {
class B {};
friend class X;
};
struct X : A::B {
A::B mx;
class Y {
A::B my;
};
};
}
namespace std_example {
class A {
protected:
struct B {}; };
struct D : A::B, A {}; }
namespace badwolf {
class A {
protected:
struct B; };
struct A::B : A {};
struct C : A::B {}; }
}
namespace dr373 { namespace X { int dr373; }
struct dr373 { void f() {
using namespace dr373::X;
int k = dr373;
namespace Y = dr373::X;
k = Y::dr373;
}
};
struct A { struct B {}; }; namespace X = A::B; using namespace A::B; }
namespace dr374 { namespace N {
template<typename T> void f();
template<typename T> struct A { void f(); };
}
template<> void N::f<char>() {}
template<> void N::A<char>::f() {}
template<> struct N::A<int> {};
}
namespace dr377 { enum E { a = -__LONG_LONG_MAX__ - 1, b = 2 * (unsigned long long)__LONG_LONG_MAX__ };
}
namespace dr381 { struct A {
int a;
};
struct B : virtual A {};
struct C : B {};
struct D : B {};
struct E : public C, public D {};
struct F : public A {};
void f() {
E e;
e.B::a = 0; F f;
f.A::a = 1;
}
}
namespace dr382 { struct A { typedef int T; };
typename A::T t;
typename dr382::A a;
#if __cplusplus < 201103L
#endif
typename A b; }
namespace dr383 { struct A { A &operator=(const A&); };
struct B { ~B(); };
union C { C &operator=(const C&); };
union D { ~D(); };
int check[(__is_pod(A) || __is_pod(B) || __is_pod(C) || __is_pod(D)) ? -1 : 1];
}
namespace dr384 { namespace N1 {
template<typename T> struct Base {};
template<typename T> struct X {
struct Y : public Base<T> {
Y operator+(int) const;
};
Y f(unsigned i) { return Y() + i; }
};
}
namespace N2 {
struct Z {};
template<typename T> int *operator+(T, unsigned);
}
int main() {
N1::X<N2::Z> v;
v.f(0);
}
}
namespace dr385 { struct A { protected: void f(); };
struct B : A { using A::f; };
struct C : A { void g(B b) { b.f(); } };
void h(B b) { b.f(); }
struct D { int n; }; struct E : protected D {}; struct F : E { friend int i(E); };
int i(E e) { return e.n; } }
namespace dr387 { namespace old {
template<typename T> class number {
number(int); friend number gcd(number &x, number &y) {}
};
void g() {
number<double> a(3), b(4); a = gcd(a, b);
b = gcd(3, 4); }
}
namespace newer {
template <typename T> class number {
public:
number(int);
friend number gcd(number x, number y) { return 0; }
};
void g() {
number<double> a(3), b(4);
a = gcd(a, b);
b = gcd(3, 4); }
}
}
namespace dr389 { struct S {
typedef struct {} A;
typedef enum {} B;
typedef struct {} const C; typedef enum {} const D; };
template<typename> struct T {};
struct WithLinkage1 {};
enum WithLinkage2 {};
typedef struct {} *WithLinkage3a, WithLinkage3b;
typedef enum {} WithLinkage4a, *WithLinkage4b;
typedef S::A WithLinkage5;
typedef const S::B WithLinkage6;
typedef int WithLinkage7;
typedef void (*WithLinkage8)(WithLinkage2 WithLinkage1::*, WithLinkage5 *);
typedef T<WithLinkage5> WithLinkage9;
typedef struct {} *WithoutLinkage1; typedef enum {} const WithoutLinkage2; typedef S::C WithoutLinkage3;
typedef S::D WithoutLinkage4;
typedef void (*WithoutLinkage5)(int (WithoutLinkage3::*)(char));
#if __cplusplus >= 201103L
typedef T<WithoutLinkage1> WithLinkage10;
#else
typedef int WithLinkage10;
typedef T<WithLinkage1> GoodArg1;
typedef T<WithLinkage2> GoodArg2;
typedef T<WithLinkage3a> GoodArg3a;
typedef T<WithLinkage3b> GoodArg3b;
typedef T<WithLinkage4a> GoodArg4a;
typedef T<WithLinkage4b> GoodArg4b;
typedef T<WithLinkage5> GoodArg5;
typedef T<WithLinkage6> GoodArg6;
typedef T<WithLinkage7> GoodArg7;
typedef T<WithLinkage8> GoodArg8;
typedef T<WithLinkage9> GoodArg9;
typedef T<WithoutLinkage1> BadArg1; typedef T<WithoutLinkage2> BadArg2; typedef T<WithoutLinkage3> BadArg3; typedef T<WithoutLinkage4> BadArg4; typedef T<WithoutLinkage5> BadArg5; #endif
extern WithLinkage1 withLinkage1;
extern WithLinkage2 withLinkage2;
extern WithLinkage3a withLinkage3a;
extern WithLinkage3b withLinkage3b;
extern WithLinkage4a withLinkage4a;
extern WithLinkage4b withLinkage4b;
extern WithLinkage5 withLinkage5;
extern WithLinkage6 withLinkage6;
extern WithLinkage7 withLinkage7;
extern WithLinkage8 withLinkage8;
extern WithLinkage9 withLinkage9;
extern WithLinkage10 withLinkage10;
extern WithoutLinkage1 withoutLinkage1;
extern WithoutLinkage2 withoutLinkage2;
extern WithoutLinkage3 withoutLinkage3;
extern WithoutLinkage4 withoutLinkage4;
extern WithoutLinkage5 withoutLinkage5;
extern "C" {
extern WithoutLinkage1 dr389_withoutLinkage1;
extern WithoutLinkage2 dr389_withoutLinkage2;
extern WithoutLinkage3 dr389_withoutLinkage3;
extern WithoutLinkage4 dr389_withoutLinkage4;
extern WithoutLinkage5 dr389_withoutLinkage5;
}
WithoutLinkage1 withoutLinkageDef1;
WithoutLinkage2 withoutLinkageDef2 = WithoutLinkage2();
WithoutLinkage3 withoutLinkageDef3 = {};
WithoutLinkage4 withoutLinkageDef4 = WithoutLinkage4();
WithoutLinkage5 withoutLinkageDef5;
void use(const void *);
void use_all() {
use(&withLinkage1); use(&withLinkage2); use(&withLinkage3a); use(&withLinkage3b);
use(&withLinkage4a); use(&withLinkage4b); use(&withLinkage5); use(&withLinkage6);
use(&withLinkage7); use(&withLinkage8); use(&withLinkage9); use(&withLinkage10);
use(&withoutLinkage1); use(&withoutLinkage2); use(&withoutLinkage3);
use(&withoutLinkage4); use(&withoutLinkage5);
use(&dr389_withoutLinkage1); use(&dr389_withoutLinkage2);
use(&dr389_withoutLinkage3); use(&dr389_withoutLinkage4);
use(&dr389_withoutLinkage5);
use(&withoutLinkageDef1); use(&withoutLinkageDef2); use(&withoutLinkageDef3);
use(&withoutLinkageDef4); use(&withoutLinkageDef5);
}
void local() {
extern WithoutLinkage1 withoutLinkageLocal;
}
}
namespace dr390 { template<typename T>
struct A {
A() { f(); } virtual void f() = 0; virtual ~A() = 0;
};
template<typename T> A<T>::~A() { T::error; } template<typename T> void A<T>::f() { T::error; } struct B : A<int> { void f() {}
} b;
}
namespace dr391 { class A { A(const A&); }; A fa();
const A &a = fa();
#if __cplusplus < 201103L
#endif
struct B { B(const B&) = delete; }; B fb();
const B &b = fb();
#if __cplusplus < 201103L
#endif
template<typename T>
struct C {
C(const C&) { T::error; }
};
C<int> fc();
const C<int> &c = fc();
}
namespace dr395 { struct S {
template <typename T, int N>(&operator T())[N]; template <typename T, int N> operator(T (&)[N])(); template <typename T> operator T *() const { return 0; }
template <typename T, typename U> operator T U::*() const { return 0; }
template <typename T, typename U> operator T (U::*)()() const { return 0; } };
struct null1_t {
template <class T, class U> struct ptr_mem_fun_t {
typedef T (U::*type)();
};
template <class T, class U>
operator typename ptr_mem_fun_t<T, U>::type() const { return 0;
}
} null1;
int (S::*p)() = null1;
template <typename T> using id = T;
struct T {
template <typename T, int N> operator id<T[N]> &();
template <typename T, typename U> operator id<T (U::*)()>() const;
};
struct null2_t {
template<class T, class U> using ptr_mem_fun_t = T (U::*)(); template<class T, class U> operator ptr_mem_fun_t<T, U>() const { return 0; };
} null2;
int (S::*q)() = null2;
}
namespace dr396 { void f() {
auto int a(); int (i); auto int (i); #if __cplusplus >= 201103L
#endif
}
}
namespace dr398 { namespace example1 {
struct S {
static int const I = 42;
};
template <int N> struct X {};
template <typename T> void f(X<T::I> *) {}
template <typename T> void f(X<T::J> *) {}
void foo() { f<S>(0); }
}
namespace example2 {
template <int I> struct X {};
template <template <class T> class> struct Z {};
template <class T> void f(typename T::Y *) {} template <class T> void g(X<T::N> *) {} template <class T> void h(Z<T::template TT> *) {} struct A {};
struct B {
int Y;
};
struct C {
typedef int N;
};
struct D {
typedef int TT;
};
void test() {
f<A>(0); f<B>(0); g<C>(0); h<D>(0); }
}
}