Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / Sema / attr-preferred-type.cpp
blobdfa7e636c21e94badb29bcd86691697664dd32bb
1 // RUN: %clang_cc1 -verify %s
3 struct A {
4 enum E : unsigned {};
5 enum E2 : int {};
6 [[clang::preferred_type(E)]] unsigned b : 2;
7 [[clang::preferred_type(E)]] int b2 : 2;
8 [[clang::preferred_type(E2)]] const unsigned b3 : 2;
9 [[clang::preferred_type(bool)]] unsigned b4 : 1;
10 [[clang::preferred_type(bool)]] unsigned b5 : 2;
11 [[clang::preferred_type()]] unsigned b6 : 2;
12 // expected-error@-1 {{'preferred_type' attribute takes one argument}}
13 [[clang::preferred_type]] unsigned b7 : 2;
14 // expected-error@-1 {{'preferred_type' attribute takes one argument}}
15 [[clang::preferred_type(E, int)]] unsigned b8 : 2;
16 // expected-error@-1 {{expected ')'}}
17 // expected-error@-2 {{expected ','}}
18 // expected-warning@-3 {{unknown attribute 'int' ignored}}