Fix test-suite fallout of default -Wreturn-type.
[official-gcc.git] / gcc / testsuite / g++.dg / ipa / pr63587-1.C
bloba727b9e9e4c76247ebc4f54046d19c7a69277c23
1 // PR ipa/63587
2 // { dg-do compile { target c++11 } }
3 // { dg-options "-O2 -fno-strict-aliasing" }
5 template <class> struct A
7 };
8 template <typename> struct B
10   template <typename> struct C;
12 class D;
13 template <typename> class F;
14 struct G
16   void operator()(const D &, D);
18 class D
20 public:
21   D (int);
23 struct H
25   H (int);
27 template <typename _Key, typename, typename, typename _Compare, typename>
28 class I
30   typedef _Key key_type;
31   template <typename _Key_compare> struct J
32   {
33     _Key_compare _M_key_compare;
34   };
35   J<_Compare> _M_impl;
37 public:
38   A<int> _M_get_insert_unique_pos (const key_type &);
39   A<int> _M_get_insert_hint_unique_pos (H &);
40   template <typename... _Args> int _M_emplace_hint_unique (H, _Args &&...);
42 template <typename _Key, typename _Tp, typename _Compare = G,
43           typename _Alloc = F<A<_Tp> > >
44 class K
46   typedef _Key key_type;
47   typedef _Key value_type;
48   typedef typename B<_Alloc>::template C<value_type> _Pair_alloc_type;
49   I<key_type, value_type, int, _Compare, _Pair_alloc_type> _M_t;
51 public:
52   void operator[](key_type)
53   {
54     _M_t._M_emplace_hint_unique (0);
55   }
57 template <typename _Key, typename _Val, typename _KeyOfValue,
58           typename _Compare, typename _Alloc>
59 A<int>
60 I<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_get_insert_unique_pos (
61   const key_type &p1)
63   _M_impl._M_key_compare (p1, 0);
64   return A<int>();
66 template <typename _Key, typename _Val, typename _KeyOfValue,
67           typename _Compare, typename _Alloc>
68 A<int>
69 I<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_get_insert_hint_unique_pos (
70   H &)
72   _M_get_insert_unique_pos (0);
73   return A<int>();
75 template <typename _Key, typename _Val, typename _KeyOfValue,
76           typename _Compare, typename _Alloc>
77 template <typename... _Args>
78 int
79 I<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_emplace_hint_unique (
80   H p1, _Args &&...)
82   _M_get_insert_hint_unique_pos (p1);
83   return 0;
85 namespace {
86 struct L;
88 void
89 fn1 ()
91   K<D, L> a;
92   a[0];
93   K<D, int> b;
94   b[0];