1 // RUN: %clang_cc1 -fexperimental-new-constant-interpreter -Wno-bitfield-constant-conversion -verify %s
2 // RUN: %clang_cc1 -verify=ref -Wno-bitfield-constant-conversion %s
3 // RUN: %clang_cc1 -std=c++20 -fexperimental-new-constant-interpreter -Wno-bitfield-constant-conversion -verify %s
4 // RUN: %clang_cc1 -std=c++20 -verify=ref -Wno-bitfield-constant-conversion %s
6 // expected-no-diagnostics
12 constexpr A() : a(0) {}
13 constexpr A(int a
) : a(a
) {}
17 static_assert(a
.a
== 1, "");
20 static_assert(a2
.a
== 2, "");
23 constexpr int storeA() {
29 static_assert(storeA() == 2, "");
31 constexpr int storeA2() {
35 static_assert(storeA2() == 2, "");
37 #if __cplusplus >= 202002
42 static_assert(I1
.a
== 1, "");
48 static_assert(I2
.a
== 0, "");
53 constexpr Init3() : a(100) {}
56 static_assert(I3
.a
== 0, "");
67 static_assert(f() == 3, "");
73 constexpr A() : a(0) {}
74 constexpr A(int a
) : a(a
) {}
77 constexpr unsigned add() {
82 static_assert(add() == 2, "");
84 constexpr unsigned sub() {
89 static_assert(sub() == 2, "");
91 constexpr unsigned mul() {
96 static_assert(mul() == 1, "");
98 constexpr unsigned div() {
103 static_assert(div() == 1, "");