[C++ PATCH] Deprecate -ffriend-injection
[official-gcc.git] / gcc / testsuite / g++.dg / lto / pr69589_1.C
blob01c16208fb5f1e767f270e13e01d827b1fd80a13
1 struct A;
2 template <class T>
3 struct Q { Q (T); };
4 template<typename T, class D>
5 struct U {
6   ~U () { m1 (nullptr); }
7   D m2 ();
8   T *u;
9   void m1 (T *) { m2 () (u); }
11 struct F { F (int *); };
12 template <class, class T = F>
13 using W = Q<T>;
14 int a, b;
15 void fn1 (void *);
16 template <class T>
17 void
18 fn2 (T *x)
20   if (x)
21     x->~T();
22   fn1 (x);
24 template <typename T>
25 struct C {
26   void operator() (T *x) { fn2 (x); }
28 struct D;
29 template <typename T, typename D = C<T> >
30 using V = U<T, D>;
31 struct A {
32   A (int *);
34 struct S;
35 struct G {
36   V<S> m3 ();
38 struct S {
39   int e;
40   virtual ~S () {}
42 template<typename T>
43 struct H {
44   H (int, T x, int) : h(x) {}
45   G g;
46   void m4 () { g.m3 (); }
47   T h;
49 struct I {
50   I(A, W<D>);
52 void
53 test ()
55   A c (&b);
56   W<D> d (&b);
57   I e (c, d);
58   H<I> f (0, e, a);
59   f.m4 ();