[docs] Add LICENSE.txt to the root of the mono-repo
[llvm-project.git] / clang / test / Sema / format-strings-bitfield-promotion.cxx
blob2309e98066c60e07d6b2392080228f5140cc37e3
1 // RUN: %clang_cc1 -triple x86_64-unknown-unknown -fsyntax-only -verify %s
2 // RUN: %clang_cc1 -triple x86_64-unknown-windows-msvc -fsyntax-only -verify %s
4 // In C++, the bitfield promotion from long to int does not occur, unlike C.
5 // expected-no-diagnostics
7 int printf(const char *restrict, ...);
9 struct bitfields {
10 long a : 2;
11 unsigned long b : 2;
12 long c : 32; // assumes that int is 32 bits
13 unsigned long d : 32; // assumes that int is 32 bits
14 } bf;
16 void bitfield_promotion() {
17 printf("%ld", bf.a);
18 printf("%lu", bf.b);
19 printf("%ld", bf.c);
20 printf("%lu", bf.d);