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
3 
4 // In C++, the bitfield promotion from long to int does not occur, unlike C.
5 // expected-no-diagnostics
6 
7 int printf(const char *restrict, ...);
8 
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;
15 
bitfield_promotion()16 void bitfield_promotion() {
17   printf("%ld", bf.a);
18   printf("%lu", bf.b);
19   printf("%ld", bf.c);
20   printf("%lu", bf.d);
21 }
22