1 // RUN: %clang_cc1 -fsyntax-only -verify %s 2 3 struct A { 4 unsigned bitX : 4; 5 unsigned bitY : 4; 6 unsigned var; 7 8 void foo(); 9 }; 10 11 void test(A *a) { 12 int x; 13 x = sizeof(a->bitX); // expected-error {{invalid application of 'sizeof' to bit-field}} 14 x = sizeof((unsigned) a->bitX); 15 x = sizeof(a->foo(), a->bitX); // expected-error {{invalid application of 'sizeof' to bit-field}} 16 x = sizeof(a->var ? a->bitX : a->bitY); // expected-error {{invalid application of 'sizeof' to bit-field}} 17 x = sizeof(a->var ? a->bitX : a->bitX); // expected-error {{invalid application of 'sizeof' to bit-field}} 18 x = sizeof(a->bitX = 3); // expected-error {{invalid application of 'sizeof' to bit-field}} 19 x = sizeof(a->bitY += 3); // expected-error {{invalid application of 'sizeof' to bit-field}} 20 } 21