| 1 |
// { dg-do assemble } |
| 2 |
// g++ 1.37.1 bug 900428_03 |
| 3 |
|
| 4 |
// g++ fails to detect cases where a constructor for a derived class invokes |
| 5 |
// (either explicitly or implicitly) a private constructor for a base class. |
| 6 |
|
| 7 |
// cfront 2.0 passes this test. |
| 8 |
|
| 9 |
// keywords: inheritance, private, accessability, constructors |
| 10 |
|
| 11 |
struct struct_0 { |
| 12 |
int struct_0_data_member; |
| 13 |
|
| 14 |
private: |
| 15 |
struct_0 (int, int); |
| 16 |
public: |
| 17 |
struct_0 (int); |
| 18 |
}; |
| 19 |
|
| 20 |
struct_0::struct_0 (int i) { } |
| 21 |
struct_0::struct_0 (int, int) { } // { dg-message "private" } |
| 22 |
|
| 23 |
struct struct_1 : public struct_0 { |
| 24 |
|
| 25 |
struct_1 (); |
| 26 |
}; |
| 27 |
|
| 28 |
struct_1::struct_1 () : struct_0 (8,9) // { dg-error "within this context" } |
| 29 |
{ |
| 30 |
} |
| 31 |
|
| 32 |
struct struct_2 { |
| 33 |
struct_0 struct_2_data_member; |
| 34 |
|
| 35 |
struct_2 (); |
| 36 |
}; |
| 37 |
|
| 38 |
struct_2::struct_2 () : struct_2_data_member (8,9) // { dg-error "within this context" } |
| 39 |
{ |
| 40 |
} |
| 41 |
|
| 42 |
int main () { return 0; } |