Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CXX / class / class.bit / p1.cpp
blob5df1ab52cdd8d41c362657dd02d61562c201fa31
1 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++20 %s
3 // Test various bit-field member declarations.
4 constexpr int foo() { return 1; }
5 struct A {
6 int a [[]] : 1;
7 int b, [[]] : 0; // expected-error {{an attribute list cannot appear here}}
8 int [[]] : 0; // OK, attribute applies to the type.
9 int [[]] c : 1; // OK, attribute applies to the type.
10 int : 2 = 1; // expected-error {{anonymous bit-field cannot have a default member initializer}}
11 int : 0 { 1 }; // expected-error {{anonymous bit-field cannot have a default member initializer}}
12 unsigned int : 0, d : 1 = 1;
13 int : 1 = 12, e : 1; // expected-error {{anonymous bit-field cannot have a default member initializer}}
14 unsigned int : 0, f : 1 = 1;
15 unsigned int g [[]] : 1 = 1;
16 unsigned int h [[]] : 1 {1};
17 unsigned int i : foo() = foo();
18 int j, [[]] k; // expected-error {{an attribute list cannot appear here}}