aboutsummaryrefslogtreecommitdiff
path: root/test/bitfield-unnamed-size-align.c
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2019-04-27 20:33:56 -0700
committerMichael Forney <mforney@mforney.org>2019-04-27 20:38:42 -0700
commit2b34742bf0dbabbdb7335838902323df66974b39 (patch)
tree021c5487c20d5bbae5ae12c4ddddf81aad135cc6 /test/bitfield-unnamed-size-align.c
parent1ef0706e1f2e97d0872eb801169de5023c3c8b7f (diff)
Unnamed bit-fields don't contribute to size or alignment of unions, or size of structs
Diffstat (limited to 'test/bitfield-unnamed-size-align.c')
-rw-r--r--test/bitfield-unnamed-size-align.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/bitfield-unnamed-size-align.c b/test/bitfield-unnamed-size-align.c
new file mode 100644
index 0000000..505467b
--- /dev/null
+++ b/test/bitfield-unnamed-size-align.c
@@ -0,0 +1,12 @@
+struct s {
+ int : 8;
+ char c;
+};
+union u {
+ int : 8;
+ char c;
+};
+int s1 = sizeof(struct s);
+int s2 = _Alignof(struct s);
+int u1 = sizeof(union u);
+int u2 = _Alignof(union u);