// RUN: %clang_cc1 -verify -std=c++11 %s template void f0() { struct X; typedef struct Y { T (X::* f1())(int) { return 0; } } Y2; Y2 y = Y(); } template void f0(); // PR5764 namespace PR5764 { struct X { template void Bar() { typedef T ValueType; struct Y { Y() { V = ValueType(); } ValueType V; }; Y y; } }; void test(X x) { x.Bar(); } } // Instantiation of local classes with virtual functions. namespace local_class_with_virtual_functions { template struct X { }; template struct Y { }; template void f() { struct Z : public X*> { virtual void g(Y* y) { } void g2(int x) {(void)x;} }; Z z; (void)z; } struct S { }; void test() { f(); } } namespace PR8801 { template void foo() { class X; typedef int (X::*pmf_type)(); class X : public T { }; pmf_type pmf = &T::foo; } struct Y { int foo(); }; template void foo(); } namespace TemplatePacksAndLambdas { template int g(T...); struct S { template static void f(int f = g([]{ static T t; return ++t; }()...)) {} }; void h() { S::f(); } } namespace PR9685 { template void forEach(Thing t) { t.func(); } template void doIt() { struct Functor { void func() { (void)i; } int i; }; forEach(Functor()); } void call() { doIt(); } } namespace PR12702 { struct S { template bool apply(F f) { return f(); } }; template struct T { void foo() { struct F { int x; bool operator()() { return x == 0; } }; S().apply(F()); } }; void call() { T().foo(); } } namespace PR17139 { template void foo(const T &t) { t.foo(); } template void bar(F *f) { struct B { F *fn; void foo() const { fn(); } } b = { f }; foo(b); } void go() {} void test() { bar(go); } } namespace PR17740 { class C { public: template static void foo(T function); template static void bar(T function); template static void func(T function); }; template void C::foo(T function) { function(); } template void C::bar(T function) { foo([&function]() { function(); }); } template void C::func(T function) { struct Struct { T mFunction; Struct(T function) : mFunction(function) {}; void operator()() { mFunction(); }; }; bar(Struct(function)); } void call() { C::func([]() {}); } } namespace PR14373 { struct function { template function(_Functor __f) { __f(); } }; template function exec_func(Func f) { struct functor { functor(Func f) : func(f) {} void operator()() const { func(); } Func func; }; return functor(f); } struct Type { void operator()() const {} }; int call() { exec_func(Type()); return 0; } } namespace PR18907 { template class C : public C {}; // expected-error{{within its own definition}} template void F() { struct A : C {}; } struct B { void f() { F(); } }; }