[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / Parser / cxx2a-bitfield-init.cpp
blob83f1575c96b99857bb7531e5f55ea40c06b6401c
1 // RUN: %clang_cc1 -std=c++2a -verify %s
3 namespace std_example {
4 int a;
5 const int b = 0; // expected-note {{here}}
6 struct S {
7 int x1 : 8 = 42;
8 int x2 : 8 { 42 };
9 int y1 : true ? 8 : a = 42;
10 int y3 : (true ? 8 : b) = 42;
11 int z : 1 || new int { 1 };
13 static_assert(S{}.x1 == 42);
14 static_assert(S{}.x2 == 42);
15 static_assert(S{}.y1 == 0);
16 static_assert(S{}.y3 == 42);
17 static_assert(S{}.z == 0);
19 struct T {
20 int y2 : true ? 8 : b = 42; // expected-error {{cannot assign to variable 'b'}}