comparison gcc/testsuite/g++.dg/cpp2a/desig6.C @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents
children
comparison
equal deleted inserted replaced
111:04ced10e8804 131:84e7813d76e9
1 // { dg-do compile }
2 // { dg-options "" }
3
4 struct A { int x, z, y; };
5 struct B { int y, a, 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 f({.x = 1, .z = 2, .y = 3}, 0); // OK; calls #1
17 // { dg-warning "extended initializer lists only available with" "" { target c++98_only } .-1 }
18 f({.y = 3, .a = 2, .x = 1}, 0); // OK; calls #2
19 // { dg-warning "extended initializer lists only available with" "" { target c++98_only } .-1 }
20 g({.x = 1, .y = 2}); // error: ambiguous between #3 and #4
21 // { dg-error "is ambiguous" "" { target *-*-* } .-1 }
22 // { dg-warning "extended initializer lists only available with" "" { target c++98_only } .-2 }
23 }