| 1 |
// PR c++/29043 |
| 2 |
// { dg-do compile } |
| 3 |
|
| 4 |
struct S // { dg-message "implicitly deleted" "" { target c++11 } } |
| 5 |
// { dg-error "uninitialized" "" { target c++11 } .-1 } |
| 6 |
{ |
| 7 |
int const i; // { dg-message "should be initialized" } |
| 8 |
}; |
| 9 |
|
| 10 |
class C |
| 11 |
{ |
| 12 |
public: |
| 13 |
C() {} // { dg-error "uninitialized const member|deleted" } |
| 14 |
S s; |
| 15 |
}; |
| 16 |
|
| 17 |
struct S2 // { dg-message "implicitly deleted" "" { target c++11 } } |
| 18 |
// { dg-error "uninitialized" "" { target c++11 } .-1 } |
| 19 |
{ |
| 20 |
int& ref; // { dg-message "should be initialized" } |
| 21 |
}; |
| 22 |
|
| 23 |
class C2 |
| 24 |
{ |
| 25 |
public: |
| 26 |
C2() {} // { dg-error "uninitialized reference member|deleted" } |
| 27 |
S2 s; |
| 28 |
}; |
| 29 |
|
| 30 |
class C3 |
| 31 |
{ |
| 32 |
C3() { } |
| 33 |
struct s { |
| 34 |
const int i; |
| 35 |
}; |
| 36 |
}; |
| 37 |
|
| 38 |
struct S4 // { dg-message "implicitly deleted" "" { target c++11 } } |
| 39 |
// { dg-error "uninitialized" "" { target c++11 } .-1 } |
| 40 |
{ |
| 41 |
int const i; // { dg-message "should be initialized" } |
| 42 |
}; |
| 43 |
|
| 44 |
struct C4 |
| 45 |
{ |
| 46 |
C4() {} // { dg-error "uninitialized const member|deleted" } |
| 47 |
S4 s4[ 1 ]; |
| 48 |
}; |
| 49 |
|
| 50 |
struct C5 |
| 51 |
{ |
| 52 |
C5() {} // { dg-error "uninitialized" } |
| 53 |
int const iit[ 1 ]; |
| 54 |
}; |
| 55 |
|