brintos

brintos / llvm-project-archived public Read only

0
0
Text · 895 B · 5df1ab5 Raw
20 lines · cpp
1// RUN: %clang_cc1 -fsyntax-only -verify -std=c++20 %s2 3// Test various bit-field member declarations.4constexpr int foo() { return 1; }5struct 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}}19};20