1 // RUN: %clang_cc1 -std=c++23 -fsyntax-only -fexperimental-new-constant-interpreter %s -verify=expected,both
2 // RUN: %clang_cc1 -std=c++23 -fsyntax-only %s -verify=ref,both
12 static_assert(f() == 1, "");
24 static_assert(f2() == 0, "");
29 if (int i
= 5; i
!= 10) {
34 static_assert(f(), "");
37 if (bool b
= false; b
) {
42 static_assert(!f2(), "");
45 constexpr int attrs() {
49 static_assert(attrs() == 1, "");
52 /// The faulty if statement creates a RecoveryExpr with contains-errors,
53 /// but the execution will never reach that.
54 constexpr char g(char const (&x
)[2]) {
56 if (auto [a
, b
] = x
) // both-error {{an array type is not allowed here}} \
57 // both-warning {{ISO C++17 does not permit structured binding declaration in a condition}}
60 static_assert(g("x") == 'x');
65 constexpr Inc(int &a
) : a(a
) {}
66 constexpr ~Inc() { ++a
; }
77 static_assert(foo() == 13, "");