* auto-profile.c (afdo_annotate_cfg): Use update_max_bb_count.
[official-gcc.git] / gcc / testsuite / g++.dg / cpp2a / bitfield3.C
blob511c8894703fc4f4b7925b18dde280a47520c7b8
1 // P0683R1
2 // { dg-do compile { target c++11 } }
3 // { dg-options "" }
5 extern "C" void abort ();
7 int
8 foo ()
10   return 2;
13 int a = foo ();
14 const int b = 0;
15 struct S {
16   int c : 5 = 2 * a;                    // { dg-warning "default member initializers for bit-fields only available with" "" { target c++17_down } }
17   int d : 6 { c + a };                  // { dg-warning "default member initializers for bit-fields only available with" "" { target c++17_down } }
18                                         // { dg-warning "narrowing conversion of" "" { target *-*-* } .-1 }
19   int e : true ? 7 : a = 3;
20   int f : (true ? 8 : b) = d + a;       // { dg-warning "default member initializers for bit-fields only available with" "" { target c++17_down } }
21   int g : (true ? 9 : b) { f + a };     // { dg-warning "default member initializers for bit-fields only available with" "" { target c++17_down } }
22                                         // { dg-warning "narrowing conversion of" "" { target *-*-* } .-1 }
23   int h : 1 || new int { 0 };
24   int i = g + a;
26 S c;
27 template <bool V, int W>
28 struct U {
29   int j : W = 3 * a;                    // { dg-warning "default member initializers for bit-fields only available with" "" { target c++17_down } }
30   int k : W { j + a };                  // { dg-warning "default member initializers for bit-fields only available with" "" { target c++17_down } }
31                                         // { dg-warning "narrowing conversion of" "" { target *-*-* } .-1 }
32   int l : V ? 7 : a = 3;
33   int m : (V ? W : b) = k + a;          // { dg-warning "default member initializers for bit-fields only available with" "" { target c++17_down } }
34   int n : (V ? W : b) { m + a };        // { dg-warning "default member initializers for bit-fields only available with" "" { target c++17_down } }
35                                         // { dg-warning "narrowing conversion of" "" { target *-*-* } .-1 }
36   int o : 1 || new int { 0 };
37   int p = n + a;
39 U<true, 10> d;
41 int
42 main ()
44   a = 1;
45   if (c.c != 4 || c.d != 6 || c.e != 0 || c.f != 8 || c.g != 10 || c.h != 0 || c.i != 12)
46     abort ();
47   if (d.j != 6 || d.k != 8 || d.l != 0 || d.m != 10 || d.n != 12 || d.o != 0 || d.p != 14)
48     abort ();
49   S s;
50   U<true, 10> u;
51   if (s.c != 2 || s.d != 3 || s.f != 4 || s.g != 5 || s.i != 6)
52     abort ();
53   if (u.j != 3 || u.k != 4 || u.m != 5 || u.n != 6 || u.p != 7)
54     abort ();