Daily bump.
[official-gcc.git] / gcc / testsuite / g++.dg / ipa / devirt-19.C
blobc14b969a26f39c8335c7b2d6770bae29f85ec110
1 /* We should specialize for &b and devirtualize the call.
2    Previously we were failing by considering CLOBBER statement to be
3    a type change.  */
4 /* { dg-do compile } */
5 /* { dg-options "-O2 -fdump-ipa-cp -fipa-cp-clone -Wno-return-type"  } */
7 struct A {
8   void operator==(const A &);
9 };
10 class B {
11 public:
12   A m_fn1();
13   A m_fn2();
15 template <typename T, typename M> class C {
16 public:
17   T Key;
18   const M &m_fn2(const T &);
19   virtual void m_fn1() {}
20   B _map;
23 C<int, int> b;
24 template <typename T, typename M> const M &C<T, M>::m_fn2(const T &) {
26   A a = _map.m_fn2();
27   a == _map.m_fn1();
28   m_fn1();
29   static M m;
30   return m;
33 void fn1() { b.m_fn2(0); }
34 /* { dg-final { scan-ipa-dump-times "Discovered a virtual call to a known target" 1 "cp"  } } */