Error compiling some C++ classes with driver v4.0

Hi, I have compiled the C++ driver 4.0 using C++17 and now trying to compile my code using installed include files. I am getting following g++ compilation errors for few C++ class files, but not sure why the macro is producing ‘_bsoncxxDisableWarningImpl_for_1’ instead of ‘_bsoncxxDisableWarningImpl_for_GCC’. What am I missing? Thanks in advance.

mongoclient-r4.0.0/include/bsoncxx/v_noabi/bsoncxx/document/value.hpp: In member function ‘bsoncxx::v_noabi::document::view bsoncxx::v_noabi::document::value::view() const’:
mongoclient-r4.0.0/include/bsoncxx/v_noabi/bsoncxx/config/util.hpp:79:20: error: ‘_bsoncxxDisableWarningImpl_for_1’ was not declared in this scope
BSONCXX_CONCAT(bsoncxxDisableWarningImpl_for, Spec)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mongoclient-r4.0.0/include/bsoncxx/v_noabi/bsoncxx/config/util.hpp:7:37: note: in definition of macro ‘BSONCXX_CONCAT_IMPL’
#define BSONCXX_CONCAT_IMPL(A, …) A##VA_ARGS
^
mongoclient-r4.0.0/include/bsoncxx/v_noabi/bsoncxx/config/util.hpp:79:5: note: in expansion of macro ‘BSONCXX_CONCAT’
BSONCXX_CONCAT(bsoncxxDisableWarningImpl_for, Spec)
^~~~~~~~~~~~~~
mongoclient-r4.0.0/include/bsoncxx/v_noabi/bsoncxx/document/value.hpp:184:9: note: in expansion of macro ‘BSONCXX_DISABLE_WARNING’
BSONCXX_DISABLE_WARNING(GCC(“-Wmaybe-uninitialized”));

Thank you for reporting. Filed CXX-3296. I expect something defines the macro GCC as 1 before including the C++ driver headers. Until a fix is released, I expect you can workaround by undefining the GCC macro before including the bsoncxx/mongocxx headers. Example:


#pragma push(GCC)

#undef GCC

#include <bsoncxx/json.hpp>

#include <mongocxx/client.hpp>

// TODO: include other bsoncxx and mongocxx headers

#pragma pop(GCC)

I thought so as well but couldn’t find anything setting GCC=1 in my env. For now, I defined _bsoncxxDisableWarningImpl_for_1 by copying _bsoncxxDisableWarningImpl_for_GCC in util.hpp. I think what you suggested should work as well. Thanks.