We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 85dae4c commit 623b66eCopy full SHA for 623b66e
clang/test/SemaCXX/attr-likelihood.cpp
@@ -159,4 +159,18 @@ constexpr int constexpr_function() {
159
[[likely]] return 0;
160
}
161
static_assert(constexpr_function() == 0);
162
+
163
+constexpr double pow(double x, long long n) noexcept {
164
+ if (n > 0) [[likely]]
165
+ return x * pow(x, n - 1);
166
+ else [[unlikely]]
167
+ return 1;
168
+}
169
+constexpr long long fact(long long n) noexcept {
170
+ if (n > 1) [[likely]]
171
+ return n * fact(n - 1);
172
173
174
175
176
#endif
0 commit comments