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