131
|
1 // { dg-do compile }
|
|
2 // { dg-options "" }
|
|
3
|
|
4 struct A { int x, y; };
|
|
5 struct B { int y, x; };
|
|
6 void f(A a, int); // #1
|
|
7 void f(B b, ...); // #2
|
|
8 void g(A a); // #3 { dg-message "candidate:" }
|
|
9 void g(B b); // #4 { dg-message "candidate:" }
|
|
10 void h() {
|
|
11 f({.x = 1, .y = 2}, 0); // OK; calls #1
|
|
12 // { dg-warning "extended initializer lists only available with" "" { target c++98_only } .-1 }
|
|
13 f({.y = 2, .x = 1}, 0); // error: selects #1
|
|
14 // { dg-error "designator order for field 'A::x' does not match declaration order in 'A'" "" { target *-*-* } .-1 }
|
|
15 // { dg-warning "extended initializer lists only available with" "" { target c++98_only } .-2 }
|
|
16 g({.x = 1, .y = 2}); // error: ambiguous between #3 and #4
|
|
17 // { dg-error "is ambiguous" "" { target *-*-* } .-1 }
|
|
18 // { dg-warning "extended initializer lists only available with" "" { target c++98_only } .-2 }
|
|
19 }
|