2 // { dg-do compile { target c++14 } }
5 foo (const int x, const unsigned n) noexcept
14 const auto m = (n >> 1);
15 const auto y = foo (x, m);
16 return ((m << 1) == n) ? y * y : x * y * y;
20 static_assert (foo (3, 2) == 9, "");
21 static_assert (foo (2, 3) == 8, "");
32 static_assert (bar (0) == 0, "");
33 static_assert (bar (1) == 1, "");
36 baz (const int x, int y) noexcept
59 for (y = 0; y < 3; y++)
103 static_assert (baz (0, 7) == 1, "");
104 static_assert (baz (1, 7) == 1, "");
105 static_assert (baz (2, -2) == 6, "");
106 static_assert (baz (2, 0) == 12, "");
107 static_assert (baz (3, 1) == 8, "");
108 static_assert (baz (4, 2) == 14, "");
109 static_assert (baz (5, -20) == 20, "");
110 static_assert (baz (6, 5) == 24, "");
111 static_assert (baz (7, -5) == 22, "");
112 static_assert (baz (7, -4) == 22, "");
113 static_assert (baz (7, -3) == 23, "");
114 static_assert (baz (7, -2) == 23, "");
115 static_assert (baz (7, -1) == 22, "");
116 static_assert (baz (7, 0) == 22, "");
117 static_assert (baz (7, 2) == 22, "");
118 static_assert (baz (7, 6) == 14, "");
119 static_assert (baz (8, 9) == 18, "");
120 static_assert (baz (8, -2) == 7, "");
121 static_assert (baz (-1, 19) == 21, "");
122 static_assert (baz (-1, 20) == 29, "");
123 static_assert (baz (-1, 21) == 27, "");
124 static_assert (baz (-1, 5) == 9, "");
125 static_assert (baz (-2, 19) == 20, "");
126 static_assert (baz (-2, 20) == 28, "");
127 static_assert (baz (-2, 21) == 26, "");
128 static_assert (baz (-2, 5) == 8, "");