File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change 1
1
// RUN: %clang_cc1 -fexperimental-new-constant-interpreter -Wno-bitfield-constant-conversion -verify %s
2
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
3
5
4
6
// expected-no-diagnostics
5
7
// ref-no-diagnostics
@@ -31,6 +33,27 @@ namespace Basic {
31
33
return a.a = 10 ;
32
34
}
33
35
static_assert (storeA2() == 2 , " " );
36
+
37
+ #if __cplusplus >= 202002
38
+ struct Init1 {
39
+ unsigned a : 2 = 1 ;
40
+ };
41
+ constexpr Init1 I1{};
42
+ static_assert (I1.a == 1 , " " );
43
+
44
+ struct Init2 {
45
+ unsigned a : 2 = 100 ;
46
+ };
47
+ constexpr Init2 I2{};
48
+ static_assert (I2.a == 0 , " " );
49
+ #endif
50
+
51
+ struct Init3 {
52
+ unsigned a : 2 ;
53
+ constexpr Init3 () : a(100 ) {}
54
+ };
55
+ constexpr Init3 I3{};
56
+ static_assert (I3.a == 0 , " " );
34
57
}
35
58
36
59
namespace Overflow {
You can’t perform that action at this time.
0 commit comments