summaryrefslogtreecommitdiffstats
path: root/test/Sema/offsetof.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/Sema/offsetof.c')
-rw-r--r--test/Sema/offsetof.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/test/Sema/offsetof.c b/test/Sema/offsetof.c
index 49d4eb4..5026193 100644
--- a/test/Sema/offsetof.c
+++ b/test/Sema/offsetof.c
@@ -53,4 +53,15 @@ 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'}}
+
+typedef struct Array { int array[1]; } Array;
+int test4 = __builtin_offsetof(Array, array);
OpenPOWER on IntegriCloud