clang no longer building with gcc 4.2.1 on PPC Mac/Leopard System

Greetings all,

Just to let you know that my attempts to build llvm-clang are halted by the following error…

/Users/donc/projects/llvmtrunk/tools/clang/lib/CodeGen/CGDeclCXX.cpp: In member function ‘void clang::CodeGen::CodeGenModule::EmitCXXThreadLocalInitFunc()’:
/Users/donc/projects/llvmtrunk/tools/clang/lib/CodeGen/CGDeclCXX.cpp:306: error: ‘class std::vector<llvm::Constant*, std::allocatorllvm::Constant* >’ has no member named ‘data’
make[2]: *** [tools/clang/lib/CodeGen/CMakeFiles/clangCodeGen.dir/CGDeclCXX.cpp.o] Error 1
make[1]: *** [tools/clang/lib/CodeGen/CMakeFiles/clangCodeGen.dir/all] Error 2
make: *** [all] Error 2

Using this CMAKE config:

janeway:cmakedllvm donc$ CC=/usr/bin/gcc-4.2 CXX=/usr/bin/g+±4.2 cmake -DLLVM_TARGETS_TO_BUILD=PowerPC -DBUILD_SHARED_LIBS=ON -DCMAKE_C_FLAGS=-fno-common -DCMAKE_CXX_FLAGS=-fno-common -DCMAKE_INSTALL_PREFIX=~/locald -DLLVM_ENABLE_ASSERTIONS=ON -DCMAKE_BUILD_TYPE=Debug -DLLVM_ENABLE_THREADS=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=ON /Users/donc/projects/llvmtrunk

Side note: Home built gcc versions 4.7.3 and 4.8.0 blast by this without so much as a warning. So…

Newer C++ standards allow this?

All build testing on a G5 with Mac OS X 10.5.8

10.5 only ships the default library from GCC 4.0, which is older than the standard recommendation to add a data() member to std::vector. Later compilers support this.

Since the data() call isn't really necessary here I removed it in r180632.

- Ben

Ben, Thanks!