clang build error

Hi!
Unfortunately clang svn trunk does not compile on my 32 bit x86 arch linux with gcc 4.3.3.
Here is the error output.

Output:
Scanning dependencies of target clangAST
[ 87%] Building CXX object tools/clang/lib/AST/CMakeFiles/clangAST.dir/ASTContext.cpp.o
[ 87%] Building CXX object tools/clang/lib/AST/CMakeFiles/clangAST.dir/CFG.cpp.o
/media/disk/download/llvm/svn/llvm/tools/clang/include/clang/AST/Stmt.h: In member function ‘clang::CFGBlock*::CFGBuilder::WalkAST(clang::Stmt*, bool)’:
/media/disk/download/llvm/svn/llvm/tools/clang/include/clang/AST/Stmt.h:113: error: ‘static void clang::Stmt::operator delete(void*)’ is protected
/media/disk/download/llvm/svn/llvm/tools/clang/lib/AST/CFG.cpp:391: error: within this context
make[2]: *** [tools/clang/lib/AST/CMakeFiles/clangAST.dir/CFG.cpp.o] Error 1
make[1]: *** [tools/clang/lib/AST/CMakeFiles/clangAST.dir/all] Error 2
make: *** [all] Error 2

Interesting. I’m not seeing that. Is there a ‘delete’ on line 391 of CFG.cpp? I see an allocation, but no delete. I suppose the ‘delete’ can be triggered if the allocation fails, but (I believe) this should only occur with exceptions enabled (which we normally don’t compile LLVM or clang with).

This could also be due to our difference in gcc versions. I’m using gcc-4.2. I’m surprised, however, that operates new/delete would be treated differently by these two versions of the compiler.

Incidentally, if you make ‘delete’ non-private (or simply remove it from Stmt), does the error go away? I’m surprised that only that particular site is failing. What happens if you do “make -i”? Do you see the same error over and over?

I think I have the fix, but I don’t have GCC 4.3.3 easily available to test. Could you try the attached patch?

  • Doug

operator-delete.patch (620 Bytes)