C++ version is also compilable with GCC 4.6
Merge branches 'upstream' and 'master'