1 // RUN: %clang_cc1 -verify -std=c++11 %s
2 // expected-no-diagnostics
7 T (X::* f1())(int) { return 0; }
13 template void f0<int>();
22 Y() { V = ValueType(); }
36 // Instantiation of local classes with virtual functions.
37 namespace local_class_with_virtual_functions {
38 template <typename T> struct X { };
39 template <typename T> struct Y { };
43 struct Z : public X<Y<T>*> {
44 virtual void g(Y<T>* y) { }
45 void g2(int x) {(void)x;}
52 void test() { f<S>(); }
59 typedef int (X::*pmf_type)();
60 class X : public T { };
62 pmf_type pmf = &T::foo;
65 struct Y { int foo(); };
67 template void foo<Y>();
70 namespace TemplatePacksAndLambdas {
71 template <typename ...T> int g(T...);
73 template <typename ...T> static void f(int f = g([]{ static T t; return ++t; }()...)) {}
75 void h() { S::f<int, int, int>(); }
79 template <class Thing> void forEach(Thing t) { t.func(); }
81 template <typename T> void doIt() {
83 void func() { (void)i; }
97 template <typename F> bool apply(F f) { return f(); }
100 template <typename> struct T {
105 bool operator()() { return x == 0; }
112 void call() { T<int>().foo(); }
116 template <class T> void foo(const T &t) { t.foo(); }
118 template <class F> void bar(F *f) {
121 void foo() const { fn(); }
128 void test() { bar(go); }
134 template <typename T> static void foo(T function);
135 template <typename T> static void bar(T function);
136 template <typename T> static void func(T function);
139 template <typename T> void C::foo(T function) { function(); }
141 template <typename T> void C::bar(T function) {
142 foo([&function]() { function(); });
145 template <typename T> void C::func(T function) {
149 Struct(T function) : mFunction(function) {};
156 bar(Struct(function));
166 template <typename _Functor> function(_Functor __f) { __f(); }
168 template <typename Func> function exec_func(Func f) {
170 functor(Func f) : func(f) {}
171 void operator()() const { func(); }
177 void operator()() const {}