"::malloc not found"


I can compile libmemcached-1.0.5 just fine with gcc/g++ (on Ubuntu 12.04). But when I try with Clang 3.0 I get:

   CXX libmemcached/csl/libmemcached_libmemcached_la-context.lo
In file included from libmemcached/csl/context.cc:38:
In file included from ./libmemcached/csl/common.h:40:
In file included from ./libmemcached/common.h:49:
/usr/include/c++/4.6/cstdlib:118:11: error: no member named 'malloc' in the global namespace
   using ::malloc;
/usr/include/c++/4.6/cstdlib:126:11: error: no member named 'realloc' in the global namespace
   using ::realloc;

Any pointers on whether this is a Clang or libmemcached problem? It compiles just fine with gcc after all...


glibc headers can be strange and gcc headers can be strange, so
"compiles fine with gcc" is not a very useful metric. I suggest you
start by using adding -save-temps and check when malloc/realloc are
defined. One item to look for: stray extern "C" blocks. GCC seems to
implicitly switch back to C++ mode for the C++ system headers, Clang