summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema/offsetof.c
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/Sema/offsetof.c')
-rw-r--r--clang/test/Sema/offsetof.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/clang/test/Sema/offsetof.c b/clang/test/Sema/offsetof.c
index 49d4eb43e42..cf88465e535 100644
--- a/clang/test/Sema/offsetof.c
+++ b/clang/test/Sema/offsetof.c
@@ -53,4 +53,12 @@ int x[__builtin_offsetof(union x, x)];
struct incomplete; // expected-note 2 {{forward declaration of 'struct incomplete'}}
int test1[__builtin_offsetof(struct incomplete, foo)]; // expected-error {{offsetof of incomplete type 'struct incomplete'}}
-int test1[__builtin_offsetof(struct incomplete[10], [4].foo)]; // expected-error {{array has incomplete element type 'struct incomplete'}}
+int test2[__builtin_offsetof(struct incomplete[10], [4].foo)]; // expected-error {{array has incomplete element type 'struct incomplete'}}
+
+// Bitfields
+struct has_bitfields {
+ int i : 7;
+ int j : 12; // expected-note{{bit-field is declared here}}
+};
+
+int test3 = __builtin_offsetof(struct has_bitfields, j); // expected-error{{cannot compute offset of bit-field 'j'}}
OpenPOWER on IntegriCloud