mongodb/libbson — pull request #16 by dgoon (2013-12-16 10:02:18+00:00)
Title: use decltype instead of typeof if __cplusplus is defined

I got this error when compiling mongoc/bson with g++ (4.6.3) in ubuntu 12.04 LTS.
gcc can compile it, but g++ fails because it doesn't have typeof.
It is reproducible with mongo-c-driver/examples/example-client.c.

.../submodule/include/libbson-1.0/bson-iter.h: In function 'bson_uint32_t bson_iter_utf8_len_unsafe(const bson_iter_t*)':
.../submodule/include/libbson-1.0/bson-iter.h:112:11: error: 'typeof' was not declared in this scope
.../submodule/include/libbson-1.0/bson-iter.h:112:11: error: expected ';' before '_a'
.../submodule/include/libbson-1.0/bson-iter.h:112:11: error: expected ';' before '_b'
.../submodule/include/libbson-1.0/bson-iter.h:112:11: error: '_a' was not declared in this scope
.../submodule/include/libbson-1.0/bson-iter.h:112:11: error: '_b' was not declared in this scope
scons: *** [whatever.o] Error 1

Using decltype when __cplusplus fixes this for me.