Shih-wei Liao | f8fd82b | 2010-02-10 11:10:31 -0800 | [diff] [blame^] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify %s |
| 2 | void f(int i); |
| 3 | void f(int i = 0); // expected-note {{previous definition is here}} |
| 4 | void f(int i = 17); // expected-error {{redefinition of default argument}} |
| 5 | |
| 6 | |
| 7 | void g(int i, int j, int k = 3); |
| 8 | void g(int i, int j = 2, int k); |
| 9 | void g(int i = 1, int j, int k); |
| 10 | |
| 11 | void h(int i, int j = 2, int k = 3, |
| 12 | int l, // expected-error {{missing default argument on parameter 'l'}} |
| 13 | int, // expected-error {{missing default argument on parameter}} |
| 14 | int n);// expected-error {{missing default argument on parameter 'n'}} |
| 15 | |
| 16 | struct S { } s; |
| 17 | void i(int = s) { } // expected-error {{no viable conversion}} |
| 18 | |
| 19 | struct X { |
| 20 | X(int); |
| 21 | }; |
| 22 | |
| 23 | void j(X x = 17); |
| 24 | |
| 25 | struct Y { // expected-note 2{{candidate}} |
| 26 | explicit Y(int); |
| 27 | }; |
| 28 | |
| 29 | void k(Y y = 17); // expected-error{{no viable conversion}} |
| 30 | |
| 31 | void kk(Y = 17); // expected-error{{no viable conversion}} |