1 // RUN: %clang_cc1 -fsyntax-only -verify %s
3 extern "C" { void f(bool); }
7 inline void f() { return f(true); }
16 void f(int) { } // expected-note{{previous}}
18 void f(int) { } // expected-error{{redefinition}}
28 void operator()(long);
32 // FIXME: give this operator() a 'float' parameter to test overloading
33 // behavior. It currently fails.
42 struct A { void f(); };
44 class C : B { using B::f; };
46 // PR5751: Resolve overloaded functions through using decls.
53 void g(void (*ptr)(int));
58 void (*f_ptr1)(double) = f;
64 // Make sure that ADL can find names brought in by using decls.
70 void foo(char *); // expected-note {{no known conversion}}
76 void test(ns::Foo *p) {
77 foo(*p); // expected-error {{no matching function for call to 'foo'}}
83 namespace ns0 { struct Foo {}; }
84 namespace A { void foo(ns0::Foo *p, int y, int z); }
85 namespace ns2 { using A::foo; }
86 namespace ns1 { struct Bar : ns0::Foo {}; }
87 namespace A { void foo(ns0::Foo *p, int y, int z = 0); } // expected-note {{candidate}}
88 namespace ns1 { using A::foo; }
89 namespace ns2 { struct Baz : ns1::Bar {}; }
90 namespace A { void foo(ns0::Foo *p, int y = 0, int z); }
92 void test(ns2::Baz *p) {
93 foo(p, 0, 0); // okay!
94 foo(p, 0); // should be fine!
95 foo(p); // expected-error {{no matching function}}
100 namespace ns { int foo; }
101 template <class T> using ns::foo; // expected-error {{cannot template a using declaration}}
105 template <typename T> void f(T);
108 template <typename T> using A::f<T>; // expected-error {{cannot template a using declaration}}
115 class Class1; // expected-note{{forward declaration}}
118 using ::foo::Class1::Function; // expected-error{{incomplete type 'foo::Class1' named in nested name specifier}}