/* { dg-do compile } */ /* { dg-options "-O -fdump-tree-optimized" } */ template struct Bar { int get() { return static_cast(this)->get2(); } }; struct Foo : public Bar { int get2() { return x; } int x; }; int foo(Foo& f) { return f.get(); } /* { dg-final { scan-tree-dump "f_..D.->x;" "optimized" } } */ /* { dg-final { cleanup-tree-dump "optimized" } } */