PR c++/85553
[official-gcc.git] / gcc / testsuite / g++.dg / ext / attrib55.C
blobdc0cdc48b7a245aa41686c8b510f2300011a23d6
1 // PR c++/84314
2 // { dg-do compile { target { { i?86-*-* x86_64-*-* } && ia32 } } }
3 // { dg-additional-options "-w -std=c++11" }
5 template <typename a, a b> struct c { static constexpr a d = b; };
6 template <bool b> using e = c<bool, b>;
7 template <bool, typename, typename> struct conditional;
8 template <typename...> struct f;
9 template <typename g, typename h>
10 struct f<g, h> : conditional<g::d, g, h>::i {};
11 template <typename...> struct j;
12 template <typename g, typename h> struct j<g, h> : conditional<1, h, g>::i {};
13 template <typename g, typename h, typename k, typename... l>
14 struct j<g, h, k, l...> : conditional<1, j<h, k>, g>::i {};
15 struct aa : e<!bool()> {};
16 template <typename, typename> struct m : c<bool, false> {};
17 template <typename, typename n> struct o {
18   template <typename> static c<bool, true> p(int);
19   typedef decltype(p<n>(0)) i;
21 template <typename, typename> struct ab : o<int, int>::i {};
22 template <typename> struct s { typedef int ad; };
23 template <bool, typename = void> struct q;
24 template <typename a> struct q<true, a> { typedef a i; };
25 template <bool, typename ae, typename> struct conditional { typedef ae i; };
26 template <typename ae, typename r> struct conditional<false, ae, r> {
27   typedef r i;
29 struct B {
30   B(int);
32 template <unsigned, typename...> struct af;
33 template <unsigned ag, typename t, typename... ah>
34 struct af<ag, t, ah...> : af<1, ah...>, B {
35   typedef af<1, ah...> ai;
36   ai al(af);
37   template <typename... am> af(af<ag, am...> p1) : ai(al(p1)), B(0) {}
39 template <unsigned ag, typename t> struct af<ag, t> {};
40 template <int, typename... ao> struct ap {
41   template <typename... am> static constexpr bool ar() {
42     return j<ab<am, ao>...>::d;
43   }
45 template <typename... ao> class as : public af<0, ao...> {
46   typedef af<0, ao...> ai;
48 public:
49   template <typename...> using au = ap<m<int, int>::d, ao...>;
50   template <typename... am,
51             typename q<au<>::template ar<am...>(), bool>::i = true>
52   as(as<am...> an) : ai(an) {}
54 template <typename... ao> as<typename s<ao>::ad...> ax(ao...);
55 namespace ay {
56 class az {};
58 using ay::az;
59 namespace ay {
60 template <typename ba> struct C { typedef ba bc; };
62 template <typename> class bd;
63 template <typename bi, typename n> using bj = f<m<bi, n>, ab<bi, n>>;
64 template <typename bf, typename... bh> class bd<bf(bh...)> {
65   struct F : bj<int, bf> {};
66   template <typename bl, typename> using bm = typename q<bl::d>::i;
68 public:
69   template <typename bg, typename = bm<aa, void>, typename = bm<F, void>>
70   bd(bg);
71   using bn = bf;
72   bn bo;
74 template <typename bf, typename... bh>
75 template <typename bg, typename, typename>
76 bd<bf(bh...)>::bd(bg) {
77   bo;
79 typedef long long(__attribute__((fastcall)) bq)(int *);
80 struct v : ay::C<as<bq, bq, int>> {
81   bc bt() { return ax(nullptr, nullptr, az()); }
83 class w {
84 public:
85   int *cc();
87 class x : w {
88   void ce();
90 namespace u {
91 class cf {
92 public:
93   static cf cg(int, int *, int, az, bd<long long(int *)>);
96 void x::ce() {
97   auto bu = 0;
98   u::cf::cg(bu, cc(), 1, {}, 0);