1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
// { dg-do run } int c; struct Base { Base() {} Base(const Base &) { ++c; } Base & operator = (const Base &); }; struct Derived : public Base {}; const Base &b = Derived(); int main() { return c; // No copies should be required. }