aboutsummaryrefslogtreecommitdiff
path: root/test/Sema/bitfield.c
diff options
context:
space:
mode:
authorEli Bendersky <eliben@chromium.org>2013-07-15 16:08:08 -0700
committerEli Bendersky <eliben@chromium.org>2013-07-15 16:08:08 -0700
commite789858899a7b36caf11b371a97411a1582a482b (patch)
treee8c28b178b32010f73b477b3c65b5ff74437530c /test/Sema/bitfield.c
parent99a5501f5ae5b75017dfc386d4abf648234e85df (diff)
parent20c7d45a4da9f58ad805ad1d37f92fe7dc232ec8 (diff)
Merge commit '20c7d45a4da9f58ad805ad1d37f92fe7dc232ec8'
Conflicts: lib/CodeGen/ItaniumCXXABI.cpp
Diffstat (limited to 'test/Sema/bitfield.c')
-rw-r--r--test/Sema/bitfield.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/Sema/bitfield.c b/test/Sema/bitfield.c
index a1ce894037..ab05a7773d 100644
--- a/test/Sema/bitfield.c
+++ b/test/Sema/bitfield.c
@@ -39,3 +39,18 @@ int y;
struct PR8025 {
double : 2; // expected-error{{anonymous bit-field has non-integral type 'double'}}
};
+
+struct Test4 {
+ unsigned bitX : 4;
+ unsigned bitY : 4;
+ unsigned var;
+};
+void test4(struct Test4 *t) {
+ (void) sizeof(t->bitX); // expected-error {{invalid application of 'sizeof' to bit-field}}
+ (void) sizeof((t->bitY)); // expected-error {{invalid application of 'sizeof' to bit-field}}
+ (void) sizeof(t->bitX = 4); // not a bitfield designator in C
+ (void) sizeof(t->bitX += 4); // not a bitfield designator in C
+ (void) sizeof((void) 0, t->bitX); // not a bitfield designator in C
+ (void) sizeof(t->var ? t->bitX : t->bitY); // not a bitfield designator in C
+ (void) sizeof(t->var ? t->bitX : t->bitX); // not a bitfield designator in C
+}