1 // RUN: %clang_cc1 -fsyntax-only -verify %s
3 void f0(int i, int j, int k = 3);
4 void f0(int i, int j, int k);
5 void f0(int i, int j = 2, int k);
6 void f0(int i, int j, int k);
7 void f0(int i = 1, // expected-note{{previous definition}}
9 void f0(int i, int j, int k); // want 2 decls before next default arg
10 void f0(int i, int j, int k);
13 void f0(int, int, int); // expected-note{{candidate}}
15 void test_f0_inner_scope() {
16 f0(); // expected-error{{no matching}}
20 void test_f0_outer_scope() {
24 void f0(int i = 1, // expected-error{{redefinition of default argument}}
27 template<typename T> void f1(T); // expected-note{{previous}}
30 void f1(T = T()); // expected-error{{cannot be added}}
34 // example from C++03 standard
35 // FIXME: make these "f2"s into "f"s, then fix our scoping issues
37 void f2(int, int = 7);
39 f2(3); // OK, calls f(3, 7)
40 void f(int = 1, int); // expected-error{{missing default argument}}
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}}
49 void f(int, int = 5); // expected-error{{redefinition of default argument}}
63 static void Foo (int = 0);
66 // should not hide default args
67 friend void B::Foo (int);