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" } */
|
131
|
6 /* { dg-additional-options "-Wno-return-type" } */
|
|
7
|
111
|
8 struct A {
|
|
9 void operator==(const A &);
|
|
10 };
|
|
11 class B {
|
|
12 public:
|
|
13 A m_fn1();
|
|
14 A m_fn2();
|
|
15 };
|
|
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;
|
|
22 };
|
|
23
|
|
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();
|
|
29 }
|
|
30
|
|
31 void fn1() { b.m_fn2(0); }
|
|
32 /* { dg-final { scan-ipa-dump-times "Discovered a virtual call to a known target" 1 "cp" } } */
|
|
33
|