22 lines · plain
1// RUN: %clang_cc1 -triple x86_64-unknown-unknown -fsyntax-only -verify %s2// RUN: %clang_cc1 -triple x86_64-unknown-windows-msvc -fsyntax-only -verify %s3 4// In C++, the bitfield promotion from long to int does not occur, unlike C.5// expected-no-diagnostics6 7int printf(const char *restrict, ...);8 9struct bitfields {10 long a : 2;11 unsigned long b : 2;12 long c : 32; // assumes that int is 32 bits13 unsigned long d : 32; // assumes that int is 32 bits14} bf;15 16void bitfield_promotion() {17 printf("%ld", bf.a);18 printf("%lu", bf.b);19 printf("%ld", bf.c);20 printf("%lu", bf.d);21}22