Debian Codegraph @

gcc/testsuite/g++.dg/ipa/devirt-52.C

raw
1 // PR middle-end/77259
2 // { dg-do compile { target c++11 } }
3 // { dg-options "-O2 -Wno-return-type" }
4
5 template <typename, typename = int> class A;
6 template <typename, typename> struct A
7 {
8 A (A &&);
9 };
10 template <typename S, typename T, typename U>
11 A<S> operator+(S *, const A<T, U> &);
12 template <typename S, typename T, typename U>
13 void operator+(const A<T, U> &, S *);
14 struct B
15 {
16 template <typename V> B (V);
17 };
18 template <typename V> V foo (B) {}
19 class C;
20 template <typename> struct D
21 {
22 C *operator->() { return d; }
23 C *d;
24 };
25 struct C
26 {
27 virtual A<int> bar ();
28 };
29 struct E
30 {
31 ~E ();
32 virtual A<char> bar (const B &) const;
33 };
34 template <typename> struct F : E
35 {
36 };
37 template <typename W> struct F<D<W>> : E
38 {
39 A<char> bar (const B &) const try
40 {
41 D<W> a = baz ();
42 }
43 catch (int)
44 {
45 }
46 D<W> baz () const
47 {
48 D<C> b = foo<D<C>>(0);
49 "" + b->bar () + "";
50 }
51 };
52 struct G : F<D<int>>
53 {
54 G (int);
55 };
56 void test () { G (0); }