[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / AST / ByteCode / cond.cpp
blob8679c116f57bbe734df949e8f5b98b1a29605612
1 // RUN: %clang_cc1 -std=c++17 -fsyntax-only -fexperimental-new-constant-interpreter %s -verify
2 // RUN: %clang_cc1 -std=c++17 -fsyntax-only %s -verify
3 // expected-no-diagnostics
5 constexpr int cond_then_else(int a, int b) {
6 if (a < b) {
7 return b - a;
8 } else {
9 return a - b;
13 constexpr int dontCallMe(unsigned m) {
14 if (m == 0) return 0;
15 return dontCallMe(m - 2);
18 // Can't call this because it will run into infinite recursion.
19 constexpr int assertNotReached() {
20 return dontCallMe(3);
23 static_assert(true || true, "");
24 static_assert(true || false, "");
25 static_assert(false || true, "");
26 static_assert(!(false || false), "");
28 static_assert(true || assertNotReached(), "");
29 static_assert(true || true || true || false, "");
31 static_assert(true && true, "");
32 static_assert(!(true && false), "");
33 static_assert(!(false && true), "");
34 static_assert(!(false && false), "");
36 static_assert(!(false && assertNotReached()), "");
37 static_assert(!(true && true && true && false), "");