| 1 |
// { dg-do assemble } |
| 2 |
// { dg-options "-pedantic-errors" } |
| 3 |
// GROUPS passed constructors |
| 4 |
// ctors file |
| 5 |
// Message-Id: <[email protected]> |
| 6 |
// From: [email protected] (Doug Moore) |
| 7 |
// Subject: 2.3.3: accepts ctor-less derived class of ctor-ful base class |
| 8 |
// Date: Wed, 13 Jan 93 14:30:21 CST |
| 9 |
// Note: It gives an error now. But not a very good one. |
| 10 |
|
| 11 |
struct Foo |
| 12 |
{ |
| 13 |
Foo(int aa); |
| 14 |
int a; |
| 15 |
const Foo* operator-> () const {return this;} |
| 16 |
}; |
| 17 |
|
| 18 |
Foo::Foo(int aa) |
| 19 |
:a(aa) |
| 20 |
{ } |
| 21 |
|
| 22 |
|
| 23 |
struct var_Foo: public Foo // { dg-message "note" "" { target c++17_down } } base.*// ERROR - in class.* |
| 24 |
{ |
| 25 |
var_Foo* operator-> () {return this;} |
| 26 |
}; |
| 27 |
|
| 28 |
int blort(Foo& f) |
| 29 |
{ |
| 30 |
return f->a; |
| 31 |
} |
| 32 |
|
| 33 |
int main() |
| 34 |
{ |
| 35 |
var_Foo b(2);// { dg-error "match" "" { target c++17_down } } |
| 36 |
b->a = 0; |
| 37 |
int x = blort(b); |
| 38 |
return x; |
| 39 |
} |