blob: 59489daf7bbe8db5b4839e2812fb4fbca6db37c0 [file] [log] [blame]
Chris Lattner04421082008-04-08 04:40:51 +00001// RUN: clang -fsyntax-only -verify %s
2void f(int i, int j, int k = 3);
3void f(int i, int j = 2, int k);
4void f(int i = 1, int j, int k);
5
6void i()
7{
8 f();
9 f(0);
10 f(0, 1);
11 f(0, 1, 2);
12}
Chris Lattner8123a952008-04-10 02:22:51 +000013
14
15int f1(int i, int i, int j) { // expected-error {{redefinition of parameter 'i'}}
16 i = 17;
17 return j;
18}
19
20int x;
21void g(int x, int y = x); // expected-error {{default argument references parameter 'x'}}
22
23void h()
24{
25 int i;
26 extern void h2(int x = sizeof(i)); // expected-error {{default argument references local variable 'i' of enclosing function}}
27}
Chris Lattner9e979552008-04-12 23:52:44 +000028
29void g2(int x, int y, int z = x + y); // expected-error {{default argument references parameter 'x'}} expected-error {{default argument references parameter 'y'}}