The BSON_ASSERT macro uses typedef tricks to force a compilation error if the static invariant it asserts is false. Unfortunately the symbols it typedefs are named only using the line number on which BSON_ASSERT is used. E.g. if there is a BSON_ASSERT on line 112, then a symbol static_assert_test_112 is involved in checking the invariant. If BSON_ASSERT is used in two files on the same line number in each, a pedantic compiler errors, "error: redefinition of typedef 'static_assert_test_112'".
See for example:
To solve, make a new macro BSON_STATIC_ASSERT2 that allows a custom string prefix:
BSON_STATIC_ASSERT2 (sizeof_counter_slots, sizeof (mongoc_counter_slots_t) == 64);
- related to
-
CDRIVER-2450 Altering BSON_STATIC_ASSERT_JOIN2 macro is an API break
- Closed