Fix test-suite fallout of default -Wreturn-type.
[official-gcc.git] / gcc / testsuite / g++.dg / ipa / devirt-19.C
blob8277deaabddd199ca8ccd77cc9b93bf23b6ef720
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"  } */
6 /* { dg-additional-options "-Wno-return-type"  } */
8 struct A {
9   void operator==(const A &);
11 class B {
12 public:
13   A m_fn1();
14   A m_fn2();
16 template <typename T, typename M> class C {
17 public:
18   T Key;
19   const M &m_fn2(const T &);
20   virtual void m_fn1() {}
21   B _map;
24 C<int, int> b;
25 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();
31 void fn1() { b.m_fn2(0); }
32 /* { dg-final { scan-ipa-dump-times "Discovered a virtual call to a known target" 1 "cp"  } } */