struct X { };
struct Y { };
bool operator+(const Y&, X* (&xs)[100]) { return false; }
typedef struct { int a; } s;
void f(s) { }
typedef enum { foo } e;
void f(e) { }
typedef union { int a; } u;
void f(u) { }
typedef struct { int a; } x,y;
void f(y) { }
void f() { }
namespace N { void f() { } }
namespace N { namespace N { void f() { } } }
extern "C" { namespace N { void unmangled_function() { } } }
extern "C" { namespace N { int unmangled_variable = 10; } }
namespace N { int i; }
namespace N { int f(int, int) { static int b; return b; } }
namespace N { int h(); void g() { static int a = h(); } }
void f(__int128_t, __uint128_t) { } 
template <typename T> struct S1 {};
void f(S1<int>) {}
void f(S1<double>) {}
template <int N> struct S2 {};
void f(S2<100>) {}
void f(S2<-100>) {}
template <bool B> struct S3 {};
void f(S3<true>) {}
void f(S3<false>) {}
struct S;
void f(void (S::*)() const) {}
void f(void (S::*)()) {}
void f(const int) { }
template<typename T, typename U> void ft1(U u, T t) { }
template<typename T> void ft2(T t, void (*)(T), void (*)(T)) { }
template<typename T, typename U = S1<T> > struct S4 { };
template<typename T> void ft3(S4<T>*) {  }
namespace NS {
  template<typename T> void ft1(T) { }
}
void g1() {
    ft1<int, double>(1, 0);
  
    ft2<char>(1, 0, 0);
  
    ft3<int>(0);
  
    NS::ft1<int>(1);
}
template<int I> struct S5 { };
template<int I> void ft4(S5<I>) { }
void g2() {
    ft4(S5<10>());
  
    ft4(S5<20>());
}
extern "C++" {
   void h() { } 
}
extern "C" { struct a { int b; }; }
int f(struct a *x) {
    return x->b;
}
extern "C" {
struct Debug {
  const Debug& operator<< (unsigned a) const { return *this; }
};
Debug dbg;
int main(void) {  dbg << 32 ;}
}
template<typename T> struct S6 {
  typedef int B;
};
template<typename T> void ft5(typename S6<T>::B) { }
template void ft5<int>(int);
template<typename T> class A {};
namespace NS {
template<typename T> bool operator==(const A<T>&, const A<T>&) { return true; }
}
template bool NS::operator==(const ::A<char>&, const ::A<char>&);
namespace std {
template<typename T> bool operator==(const A<T>&, const A<T>&) { return true; }
}
template bool std::operator==(const ::A<char>&, const ::A<char>&);
struct S {
  typedef int U;
};
template <typename T> typename T::U ft6(const T&) { return 0; }
template int ft6<S>(const S&);
template<typename> struct __is_scalar_type {
  enum { __value = 1 };
};
template<bool, typename> struct __enable_if { };
template<typename T> struct __enable_if<true, T> {
  typedef T __type;
};
template<typename T> typename __enable_if<__is_scalar_type<T>::__value, void>::__type ft7() { }
template void ft7<int>();
template void ft7<void*>();
extern "C" {
void extern_f(void);
};
void extern_f(void) { }
struct S7 {
  S7();
  
  struct S { S(); };
  struct {
    S s;
  } a;
};
S7::S7() {}
template<typename T> typename __enable_if<(__is_scalar_type<T>::__value), void>::__type ft8() { }
template void ft8<int>();
template void ft8<void*>();
namespace PR5796 {
template<typename> struct __is_scalar_type {
  enum { __value = 0 };
};
template<bool, typename> struct __enable_if {};
template<typename T> struct __enable_if<true, T> { typedef T __type; };
template<typename T>
typename __enable_if<!__is_scalar_type<T>::__value, void>::__type __fill_a() { };
void f() { __fill_a<int>(); }
}
namespace Expressions {
template <int i> void f1(int (*)[(-i) + 2]) { };
template void f1<1>(int (*)[1]);
template <int i> void f2(int (*)[+i]) { };
template void f2<1>(int (*)[1]);
template <int i> void f3(int (*)[i+i]) { };
template void f3<1>(int (*)[2]);
template <int i> void f4(int (*)[2 + i+i]) { };
template void f4<1>(int (*)[4]);
template <bool b> void f4(int (*)[b ? 1 : 2]) { };
template void f4<true>(int (*)[1]);
}
struct Ops {
  Ops& operator+(const Ops&);
  Ops& operator-(const Ops&);
  Ops& operator&(const Ops&);
  Ops& operator*(const Ops&);
  
  void *v;
};
Ops& Ops::operator+(const Ops&) { return *this; }
Ops& Ops::operator-(const Ops&) { return *this; }
Ops& Ops::operator&(const Ops&) { return *this; }
Ops& Ops::operator*(const Ops&) { return *this; }
namespace PR5861 {
template<bool> class P;
template<> class P<true> {};
template<template <bool> class, bool>
struct Policy { };
template<typename T, typename = Policy<P, true> > class Alloc
{
  T *allocate(int, const void*) { return 0; }
};
template class Alloc<char>;
}
void f(int (^)(int, int)) { }
void pr5966_foo() {
  extern int pr5966_i;
  pr5966_i = 0;
}
static int pr5966_j;
void pr5966_bar() {
  pr5966_j = 0;
}
namespace test0 {
  int ovl(int x);
  char ovl(double x);
  template <class T> void f(T, char (&buffer)[sizeof(ovl(T()))]) {}
  void test0() {
    char buffer[1];
    f(0.0, buffer);
  }
    
  void test1() {
    char buffer[sizeof(int)];
    f(1, buffer);
  }
    
  template <class T> void g(char (&buffer)[sizeof(T() + 5.0f)]) {}
  void test2() {
    char buffer[sizeof(float)];
    g<float>(buffer);
  }
  
  template <class T> void h(char (&buffer)[sizeof(T() + 5.0)]) {}
  void test3() {
    char buffer[sizeof(double)];
    h<float>(buffer);
  }
  
  template <class T> void j(char (&buffer)[sizeof(T().buffer)]) {}
  struct A { double buffer[128]; };
  void test4() {
    char buffer[1024];
    j<A>(buffer);
  }
  
  template <class T> void k(char (&buffer)[sizeof(T() + 0.0f)]) {}
  void test5() {
    char buffer[sizeof(float)];
    k<float>(buffer);
  }
  
}
namespace test1 {
  template<typename T> struct X { };
  template<template<class> class Y, typename T> void f(Y<T>) { }
    template void f(X<int>);
}
static void functionWithInternalLinkage() {  }
void g() { functionWithInternalLinkage(); }
namespace test2 {
  template <class T> decltype(((T*) 0)->member) read_member(T& obj) {
    return obj.member;
  }
  struct A { int member; } obj;
  int test() {
    return read_member(obj);
  }
  }
namespace test3 {
  struct AmbiguousBase { int ab; };
  struct Path1 : AmbiguousBase { float p; };
  struct Path2 : AmbiguousBase { double p; };
  struct Derived : Path1, Path2 { };
    template <class T> decltype(((T*) 0)->Path1::ab) get_ab_1(T &ref) { return ref.Path1::ab; }
    template <class T> decltype(((T*) 0)->Path2::ab) get_ab_2(T &ref) { return ref.Path2::ab; }
    template <class T> decltype(((T*) 0)->Path1::p) get_p_1(T &ref) { return ref.Path1::p; }
    template <class T> decltype(((T*) 0)->Path2::p) get_p_2(T &ref) { return ref.Path2::p; }
  Derived obj;
  void test() {
    get_ab_1(obj);
    get_ab_2(obj);
    get_p_1(obj);
    get_p_2(obj);
  }
}
namespace test4 {
  struct foo { int bar; };
  template <int (foo::*)>
  struct zed {};
  void g(zed<&foo::bar>*)
  {}
}
namespace test5 {
  struct foo { static int bar; };
  template <int *>
  struct zed {};
  void g(zed<&foo::bar>*)
  {}
}
namespace test6 {
  struct foo { int bar(); };
  template <int (foo::*)()>
  struct zed {};
  void g(zed<&foo::bar>*)
  {}
}
namespace test7 {
  struct foo { static int bar(); };
  template <int (*f)()>
  struct zed {};
  void g(zed<&foo::bar>*)
  {}
}
namespace test8 {
  template <int &counter> class A { void inc() { counter++; } };
  class B { public: static int value; };
  template class A<B::value>;
}
namespace test9 {
  template<class T>
  struct foo {
    typedef T X;
  };
  struct bar {
    typedef foo<int> baz;
  };
  template <class zaz, class zed>
  void f(const typename zed::baz::X&);
  void g() {
    f<int, bar>( 0);
  }
}
namespace test10 {
  template <char P1> struct S {};
  template <char P2> void f(struct S<false ? 'a' : P2> ) {}
    template void f<(char) 3>(struct S<3>);
}
namespace test11 {
    void f(...) { }
  struct A {
    void f(...);
  };
  
    void A::f(...) { }
}
namespace test12 {
    template <unsigned short> struct A { };
  void f(A<33000>) { }
}
namespace test13 {
  template <template <class> class T> class A {};
  template <class U> class B {};
  template <template<class> class T> void foo(const A<T> &a) {}
    template void foo(const A<B> &a);
}
namespace test14 {
  extern "C" {
    struct S {
      static int a(), x;
    };
            int S::a() { return S::x; }
  }
}
namespace test15 {
  enum E { e = 3 };
  template <int I> struct S {};
  template <int I> void f(S<I + e>) {}
    template void f<7>(S<7 + e>);
}
namespace test17 {
  template <int N> struct A {};
  struct B {
    static int foo(void);
  };
  template <class T> A<sizeof(T::foo())> func(void);
      void test() {
    func<B>();
  }
}
namespace test18 {
  struct A {
    int operator+();
    int operator-();
    int operator*();
    int operator&();
  };
  template <int (A::*)()> struct S {};
  template <typename T> void f(S<&T::operator+>) {}
  template void f<A>(S<&A::operator+>);
  template <typename T> void f(S<&T::operator- >) {}
  template void f<A>(S<&A::operator- >);
  template <typename T> void f(S<&T::operator*>) {}
  template void f<A>(S<&A::operator*>);
  template <typename T> void f(S<&T::operator&>) {}
  template void f<A>(S<&A::operator&>);
        }
namespace test19 {
  struct A {
    template <typename T> int f();
    int operator+();
    operator int();
    template <typename T> int operator-();
  };
  template <int (A::*)()> struct S {};
  template <typename T> void g (S<&T::template f<int> >) {}
  template <typename T> void g (S<&T::operator+ >) {}
  template <typename T> void g (S<&T::operator int>) {}
  template <typename T> void g (S<&T::template operator- <double> >) {}
    template void g<A>(S<&A::f<int> >);
    template void g<A>(S<&A::operator+>);
    template void g<A>(S<&A::operator int>);
    template void g<A>(S<&A::operator-<double> >);
}
namespace test20 {
  template <class T> T *f(const T&);
  template <class T> T *f(T*);
    template <class T> void test0(decltype(f<T*>(0))) {}
  template void test0<int>(decltype(f<int*>(0)));
    template <class T> void test1(decltype(f<>(T()))) {}
  template void test1<int>(decltype(f<>(int())));
}
namespace test21 {
    void vla_arg_func(int X, int a[X][X]) {}
}
namespace test22 {
    void f(decltype(nullptr)) { }
}
namespace test23 {
  typedef void * const vpc;
    void f(vpc (&)[10]) {}
  typedef vpc vpca5[5];
  void f(vpca5 volatile (&)[10]) {}
  }
namespace test24 {
  void test0() {
    extern int foo();
        foo();
  }
  static char bar() {}
  void test1() {
        bar();
  }
}
namespace test25 {
  template <void (*fn)()> struct A {
    static void call() { fn(); }
  };
  void foo();
  void test() {
        A<foo>::call();
  }
}
namespace test26 {
  template <template <class> class T> void foo(decltype(T<float>::object) &object) {}
  template <class T> struct holder { static T object; };
  void test() {
    float f;
        foo<holder>(f);
  }
}
namespace test27 {
  struct A {
    struct inner {
      float object;
    };
    float meth();
  };
  typedef A Alias;
  template <class T> void a(decltype(T::inner::object) &object) {}
  template <class T> void b(decltype(T().Alias::meth()) &object) {}
  void test() {
    float f;
        a<A>(f);
        b<A>(f);
  }
}
namespace test28 {
  template <class T> struct A {
    enum { bit };
  };
  template <class T> void foo(decltype(A<T>::A::bit) x);
  void test() {
    foo<char>(A<char>::bit);
      }
}
namespace test29 {
  template <class T> struct A {
    template <class U> static void foo(decltype(T::fn(U())) x);
  };
  struct B { static int fn(int); static long fn(long); };
  void test() {
    A<B>::foo<int>(0);
      }
}
namespace test30 {
  template <template <class> class T> struct A {
    template <class U> static void foo(decltype(T<U>::fn()) x);
  };
  template <class T> struct B { static T fn(); };
  void test() {
    A<B>::foo<int>(0);
      }
}
namespace test31 {   int x;
  template<class T> auto f1(T p)->decltype(x) { return 0; }
      template<class T> auto f2(T p)->decltype(p) { return 0; }
      void g(int);
  template<class T> auto f3(T p)->decltype(g(p)) {}
    template int f1(int);
    template int f2(int);
    template void f3(int);
}
namespace test32 {
  template<typename T, int=T::value> struct A {
    typedef int type;
  };
  struct B { enum { value = 4 }; };
  template <class T> typename A<T>::type foo() { return 0; }
  void test() {
    foo<B>();
      }
}
namespace test33 {
  template <class T> struct X {
    enum { value = T::value };
  };
  template<typename T, int=X<T>::value> struct A {
    typedef int type;
  };
  struct B { enum { value = 4 }; };
  template <class T> typename A<T>::type foo() { return 0; }
  void test() {
    foo<B>();
      }
}
namespace test34 {
    template<typename T>
  void f(decltype(sizeof(decltype(T() + T())))) {}
    template void f<int>(decltype(sizeof(1)));
    template<unsigned N>
  void f2(int (&)[N + sizeof(int*)]) {}
    template void f2<4>(int (&)[4 + sizeof(int*)]);
      template<unsigned long long N>
  void f3(int (&)[N + sizeof(int*)]) {}
    template void f3<4>(int (&)[4 + sizeof(int*)]);
      template<unsigned> struct A { };
  template<typename T> void f4(::test34::A<sizeof(sizeof(decltype(T() + T())))>) { }
    template void f4<int>(A<sizeof(sizeof(int))>);
}
namespace test35 {
    struct A { 
    template<typename U> A operator+(U) const;
  };
  template<typename T>
  void f1(decltype(sizeof(&T::template operator+<int>))) {}
    template void f1<A>(__SIZE_TYPE__);
}
namespace test36 {
  template<unsigned> struct A { };
  template<typename ...Types>
  auto f1(Types... values) -> A<sizeof...(values)> { }
    template A<2> f1(int, float);
}
namespace test37 {
  struct foo {
    struct {
    } a;
    typedef struct { } b;
    typedef struct { } *c;
    struct {
    } d;
  };
  template<typename T> void func(T) { }
  void test() {
        func(foo().a);
        func(*foo::c());
        func(foo().d);
  }
}
void ASfunc(__attribute__((address_space(3))) int* x) {}
namespace test38 {
    typedef struct {
    struct {
    } a;
  } foo;
  template <typename T> void func(T) {}
  void test() { func(foo().a); }
}
namespace test39 {
    typedef struct {
    struct {} a;
  } *foo;
  template<typename T> void func(T) {}
  void test() {
    foo x;
    func(x->a);
  }
}
namespace test40 {
    void h(int&);
  inline void f() {
    if (0) {
      static int a;
    }
    static int a;
    h(a);
  };
  void g() { f(); }
}
namespace test41 {
    template <int i, class T> struct foo {
    template <class T2 = T> friend void func(foo x) {}
  };
  struct X {};
  void g() { func(foo<20, X>()); }
}
namespace test42 {
    template <int i, template <class> class T> struct foo {
    template <template <class> class T2 = T> friend void func(foo x) {}
  };
  template <class V> struct X {
  };
  void g() { func(foo<20, X>()); }
}
namespace test43 {
    struct foo { union { int bar; }; };
  template <int (foo::*)>
  struct zed {};
  void g(zed<&foo::bar>*)
  {}
}
namespace test44 {
  struct foo { void bar() __restrict { }; } obj;
  void f() {
    obj.bar();
  }
  }
namespace test45 {
  struct S {
    enum e {};
  };
  template <typename T>
  void f(enum T::e *) {}
  template void f<S>(S::e *);
  }
namespace test46 {
  struct S {
    struct s {};
  };
  template <typename T>
  void f(struct T::s *) {}
  template void f<S>(S::s *);
  }
namespace test47 {
  struct S {
    class c {};
  };
  template <typename T>
  void f(class T::c *) {}
  template void f<S>(S::c *);
  }
namespace test48 {
  struct S {
    union u {};
  };
  template <typename T>
  void f(union T::u *) {}
  template void f<S>(S::u *);
  }
namespace test49 {
  template <int>
  struct S {};
  template <template <int> class T>
  T<3> fin(T<3>);
  auto v = fin<S>;
  }
namespace test50 {
  template <int>
  struct S {};
  template <template <int> class T>
  T<3> fin(T<4>);
  auto v = fin<S>;
  }
namespace test51 {
  template <typename T>
  decltype(T().~T()) fun() {}
  template void fun<int>();
    template void fun<X>();
    template void fun<S1<int> >();
  
  enum E {};
  template <typename T>
  struct X {
    struct Y {};
  };
  template <typename T>
  decltype(S1<T>().~S1<T>()) fun1() {};
  template <typename U, typename T>
  decltype(U().~S1<T>()) fun2() {}
  template <typename U, typename T>
  decltype(S1<T>().~U()) fun3() {}
  template <typename T>
  decltype(S1<T>().~S1<T>(), S1<T>().~S1<T>()) fun4() {};
  template <typename T>
  decltype(S1<int>().~S1<T>()) fun5(){};
  template <template <typename T> class U>
  decltype(S1<int>().~U<int>()) fun6(){};
  template <typename T>
  decltype(E().E::~T()) fun7() {}
  template <template <typename> class U>
  decltype(X<int>::Y().U<int>::Y::~Y()) fun8() {}
  template void fun1<int>();
    template void fun2<S1<int>, int>();
    template void fun3<S1<int>, int>();
    template void fun4<int>();
    template void fun5<int>();
    template void fun6<S1>();
    template void fun7<E>();
    template void fun8<X>();
}
namespace test52 {
struct X {};
void operator+(X);
template <typename... T>
auto f4(T... x) -> decltype(operator+(x...));
void use() { f4(X{}); }
}
namespace test53 {
struct c {
  using t1 = struct { int z; };
  using t2 = struct { double z; };
  using t3 = struct { float z; };
  using t4 = struct { float z; };
  __attribute__((used)) c(t1) {}
  __attribute__((used)) c(t2) {}
  __attribute__((used)) c(t3) {}
  __attribute__((used)) c(t4) {}
        };
}
namespace test54 {
struct c {
  using t1 = struct { int z; } *;
  using t2 = struct { double z; } *;
  __attribute__((used)) c(t1) {}
  __attribute__((used)) c(t2) {}
    };
}
namespace test55 {
enum E { R };
template <typename T>
void fn(T, __underlying_type(T)) {}
template void fn<E>(E, __underlying_type(E));
}
namespace test56 {
  struct A { A *operator->(); int n; } a;
  template<int N> void f(decltype(a->n + N)) {}
    template void f<0>(int);
}
namespace test57 {
  struct X { template <int N> int f(); } x;
  template<int N> void f(decltype(x.f<0>() + N)) {}
    template void f<0>(int);
}
namespace test58 {
  struct State {
   bool m_fn1();
  } a;
  template <class T> struct identity { typedef T type; };
  struct A {
   template <typename T> A(T, bool (identity<T>::type::*)());
  };
    void fn1() { A(a, &State::m_fn1); }
}
namespace test59 {
    template<typename T>
  void f(T g) {
    auto [e] = g;
    [](decltype(e)) {};
  }
}
namespace test60 {
  struct X { int i, j; };
  auto [a,b] = X{1,2};
  template<typename T> void f(decltype(a + T())) {}
    template void f<int>(int);
}
namespace test61 {
  struct X {
    struct Y {
      using a = int;
      using b = int;
    };
  };
  template <typename T> void f(typename T::Y::a, typename T::Y::b) {}
    template void f<X>(int, int);
}