Debian Codegraph @

gcc/testsuite/g++.dg/opt/pr48967.C

raw
1 // PR debug/48967
2 // { dg-do compile }
3 // { dg-options "-g -O2" }
4
5 template <typename> struct A;
6 template <typename T> struct A <T *>
7 {
8 typedef T ref;
9 };
10 template <typename T, typename> struct B
11 {
12 typedef A <T> t;
13 typedef typename t::ref ref;
14 ref operator * () { return ref (); }
15 };
16 template <typename T> struct I
17 {
18 typedef T *cp;
19 template <typename T1> struct J
20 {
21 typedef I <T1> other;
22 };
23 };
24 template <typename T> struct S : public I <T>
25 {
26 };
27 template <typename T, typename _A> struct E
28 {
29 typedef typename _A::template J <T>::other at;
30 };
31 template <typename T, typename _A = S <T> > struct D
32 {
33 typedef E <T, _A> _Base;
34 typedef typename _Base::at at;
35 typedef typename at::cp cp;
36 typedef B <cp, D> H;
37 };
38 template <class T> struct F
39 {
40 T *operator -> () { return __null; }
41 };
42 template <typename T> long
43 lfloor (T x)
44 {
45 return static_cast <long>(x) - (x && x != static_cast <long>(x));
46 }
47 template <typename T> long
48 lround (T x)
49 {
50 return lfloor (x - 0.5) + 1;
51 }
52 class M;
53 template <typename> class P;
54 typedef P <M> Q;
55 template <typename> struct P
56 {
57 float x ();
58 };
59 struct CV
60 {
61 Q c;
62 };
63 struct C
64 {
65 void foo (const CV &) const;
66 class O;
67 typedef D <F <O> > R;
68 R n;
69 };
70 struct S3
71 {
72 S3 (int, int);
73 };
74 struct S2
75 {
76 S3 sx, sy;
77 S2 (int x = 0, int y = 0, int s = 0, int t = 0) : sx (x, y), sy (s, t) {}
78 };
79 template <typename> struct N
80 {
81 int bar ();
82 };
83 struct C::O
84 {
85 N <float> o;
86 void foo (CV r, int)
87 {
88 Q c = r.c;
89 float t = 0.5 * (o.bar ());
90 S2 (lround (c.x ()), t);
91 }
92 };
93 void
94 C::foo (const CV &w) const
95 {
96 R::H m;
97 (*m)->foo (w, 8);
98 }