Home | History | Annotate | Download | only in SemaCXX
      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 // expected-note{{passing argument to parameter here}}
     19 
     20 struct X {
     21   X(int);
     22 };
     23 
     24 void j(X x = 17);
     25 
     26 struct Y { // expected-note 2{{candidate}}
     27   explicit Y(int);
     28 };
     29 
     30 void k(Y y = 17); // expected-error{{no viable conversion}} \
     31 // expected-note{{passing argument to parameter 'y' here}}
     32 
     33 void kk(Y = 17); // expected-error{{no viable conversion}} \
     34 // expected-note{{passing argument to parameter here}}
     35