111
|
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 struct A {
|
|
7 void operator==(const A &);
|
|
8 };
|
|
9 class B {
|
|
10 public:
|
|
11 A m_fn1();
|
|
12 A m_fn2();
|
|
13 };
|
|
14 template <typename T, typename M> class C {
|
|
15 public:
|
|
16 T Key;
|
|
17 const M &m_fn2(const T &);
|
|
18 virtual void m_fn1() {}
|
|
19 B _map;
|
|
20 };
|
|
21
|
|
22 C<int, int> b;
|
|
23 template <typename T, typename M> const M &C<T, M>::m_fn2(const T &) {
|
|
24 A a = _map.m_fn2();
|
|
25 a == _map.m_fn1();
|
|
26 m_fn1();
|
|
27 }
|
|
28
|
|
29 void fn1() { b.m_fn2(0); }
|
|
30 /* { dg-final { scan-ipa-dump-times "Discovered a virtual call to a known target" 1 "cp" } } */
|
|
31
|