summaryrefslogtreecommitdiff
path: root/bindgen-integration/cpp/Test.cc
diff options
context:
space:
mode:
authorEmilio Cobos Álvarez <emilio@crisal.io>2017-06-04 01:22:07 +0200
committerEmilio Cobos Álvarez <emilio@crisal.io>2017-06-05 20:05:01 +0200
commit10106aa8a40f36477fdc9cd034d9a2eec2698318 (patch)
tree043ca73acc6457521eca880e2379ed711c783f04 /bindgen-integration/cpp/Test.cc
parent1f87fc87bc0ffb90e1ff22e19e31b53bfdae64b9 (diff)
ir: Fix a bunch of bitfield correctness issues.
In particular, the "flush the allocation unit" logic is only valid for ms_structs (that is, MSVC). It's slightly annoying to have this different behavior, but it'd work just fine if we'd turn that on for MSVC. This patch doesn't do that, yet at least, and adds tests for all the weird bitfield alignments around. Fixes #726 (and another set of hidden issues by the old code).
Diffstat (limited to 'bindgen-integration/cpp/Test.cc')
-rw-r--r--bindgen-integration/cpp/Test.cc20
1 files changed, 20 insertions, 0 deletions
diff --git a/bindgen-integration/cpp/Test.cc b/bindgen-integration/cpp/Test.cc
index 7b0ec4ad..9d91250c 100644
--- a/bindgen-integration/cpp/Test.cc
+++ b/bindgen-integration/cpp/Test.cc
@@ -56,4 +56,24 @@ Third::assert(int first, bool second, ItemKind third)
kind == third;
}
+bool
+Fourth::assert(MyEnum tag, unsigned long ptr)
+{
+ return this->tag == tag && this->ptr == ptr;
+}
+
+bool
+Date2::assert(unsigned short nWeekDay,
+ unsigned short nMonthDay,
+ unsigned short nMonth,
+ unsigned short nYear,
+ unsigned short byte)
+{
+ return this->nWeekDay == nWeekDay &&
+ this->nMonthDay == nMonthDay &&
+ this->nMonth == nMonth &&
+ this->nYear == nYear &&
+ this->byte == byte;
+}
+
} // namespace bitfields