1// RUN: %clang_cc1 -fsyntax-only -verify %s 2 3void f0(int i, int j, int k = 3); 4void f0(int i, int j, int k); 5void f0(int i, int j = 2, int k); 6void f0(int i, int j, int k); 7void f0(int i = 1, // expected-note{{previous definition}} 8 int j, int k); 9void f0(int i, int j, int k); // want 2 decls before next default arg 10void f0(int i, int j, int k); 11 12namespace N0 { 13 void f0(int, int, int); // expected-note{{candidate}} 14 15 void test_f0_inner_scope() { 16 f0(); // expected-error{{no matching}} 17 } 18} 19 20void test_f0_outer_scope() { 21 f0(); // okay 22} 23 24void f0(int i = 1, // expected-error{{redefinition of default argument}} 25 int, int); 26 27template<typename T> void f1(T); // expected-note{{previous}} 28 29template<typename T> 30void f1(T = T()); // expected-error{{cannot be added}} 31 32 33namespace N1 { 34 // example from C++03 standard 35 // FIXME: make these "f2"s into "f"s, then fix our scoping issues 36 void f2(int, int); 37 void f2(int, int = 7); 38 void h() { 39 f2(3); // OK, calls f(3, 7) 40 void f(int = 1, int); // expected-error{{missing default argument}} 41 } 42 43 void m() 44 { 45 void f(int, int); // expected-note{{'f' declared here}} 46 f(4); // expected-error{{too few arguments to function call}} 47 void f(int, int = 5); // expected-note{{previous definition}} 48 f(4); // okay 49 void f(int, int = 5); // expected-error{{redefinition of default argument}} 50 } 51 52 void n() 53 { 54 f2(6); // okay 55 } 56} 57 58 59namespace PR18432 { 60 61struct A { 62 struct B { 63 static void Foo (int = 0); 64 }; 65 66 // should not hide default args 67 friend void B::Foo (int); 68}; 69 70void Test () 71{ 72 A::B::Foo (); 73} 74 75} // namespace 76