Skip to content

Commit 623b66e

Browse files
[Clang][NFC] Added testcase from #49549
The issue is fixed in trunk, so add testcase to avoid regression in the future.
1 parent 85dae4c commit 623b66e

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

clang/test/SemaCXX/attr-likelihood.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,4 +159,18 @@ constexpr int constexpr_function() {
159159
[[likely]] return 0;
160160
}
161161
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+
else [[unlikely]]
173+
return 1;
174+
}
175+
162176
#endif

0 commit comments

Comments
 (0)