1 // PR rtl-optimization/36185
2 // { dg-do run }
3 // { dg-options "-O2 -fgcse-sm" }
4 
5 struct Base {
~BaseBase6         virtual ~Base() {}
7         virtual void f() = 0;
8 };
9 struct Derived : Base {
10         Derived();
fDerived11         virtual void f() {}
12 };
13 struct Foo {
14         Foo(Base&);
15 };
Derived()16 Derived::Derived() {
17         Foo foo(*this);
18 }
Foo(Base & base)19 Foo::Foo(Base& base) {
20         base.f();
21 }
main()22 int main() {
23         Derived d;
24 }
25