summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDávid Bolvanský <david.bolvansky@gmail.com>2022-01-31 23:43:36 +0100
committerDávid Bolvanský <david.bolvansky@gmail.com>2022-01-31 23:43:36 +0100
commit7d8d30d6d3ddb37230a519bf4ee8144a547e4195 (patch)
tree6ee361e5ad4468defaa22e5bacc4c3d815ce6449
parentae990a3cbd05f4a94be2e3daa93d5d078ac133d3 (diff)
[Clang][NFC] Added testcase from #49549arcpatch-D60031
The issue is fixed in trunk, so add testcase to avoid regression in the future.
-rw-r--r--clang/test/SemaCXX/attr-likelihood.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/attr-likelihood.cpp b/clang/test/SemaCXX/attr-likelihood.cpp
index f7503fed49b9..642d62fa8982 100644
--- a/clang/test/SemaCXX/attr-likelihood.cpp
+++ b/clang/test/SemaCXX/attr-likelihood.cpp
@@ -159,4 +159,18 @@ constexpr int constexpr_function() {
[[likely]] return 0;
}
static_assert(constexpr_function() == 0);
+
+constexpr double pow(double x, long long n) noexcept {
+ if (n > 0) [[likely]]
+ return x * pow(x, n - 1);
+ else [[unlikely]]
+ return 1;
+}
+constexpr long long fact(long long n) noexcept {
+ if (n > 1) [[likely]]
+ return n * fact(n - 1);
+ else [[unlikely]]
+ return 1;
+}
+
#endif