blob: e9d8a2f767bcb224958c33a5ea6ea4a9f259b814 [file] [log] [blame]
Daniel Dunbara5728872009-12-15 20:14:24 +00001// RUN: %clang_cc1 -fsyntax-only -verify %s
Chris Lattner04421082008-04-08 04:40:51 +00002void f(int i);
Chris Lattner5f4a6822008-11-23 23:12:31 +00003void f(int i = 0); // expected-note {{previous definition is here}}
Chris Lattner04421082008-04-08 04:40:51 +00004void f(int i = 17); // expected-error {{redefinition of default argument}}
5
6
7void g(int i, int j, int k = 3);
8void g(int i, int j = 2, int k);
9void g(int i = 1, int j, int k);
10
11void 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
16struct S { } s;
Douglas Gregora41a8c52010-04-22 00:20:18 +000017void i(int = s) { } // expected-error {{no viable conversion}} \
18// expected-note{{passing argument to parameter here}}
Douglas Gregoreb704f22008-11-04 13:57:51 +000019
20struct X {
21 X(int);
22};
23
24void j(X x = 17);
25
Douglas Gregor7abfbdb2009-12-19 03:01:41 +000026struct Y { // expected-note 2{{candidate}}
Douglas Gregoreb704f22008-11-04 13:57:51 +000027 explicit Y(int);
28};
29
Douglas Gregora41a8c52010-04-22 00:20:18 +000030void k(Y y = 17); // expected-error{{no viable conversion}} \
31// expected-note{{passing argument to parameter 'y' here}}
Douglas Gregor61366e92008-12-24 00:01:03 +000032
Douglas Gregora41a8c52010-04-22 00:20:18 +000033void kk(Y = 17); // expected-error{{no viable conversion}} \
34// expected-note{{passing argument to parameter here}}