[cfe-dev] r127596 "Make dealloc noexcept" breaks -std=c++0x with darwin libstdc++

Jean-Daniel Dupas devlists at shadowlab.org
Tue Mar 15 03:36:56 PDT 2011


Hello,

After the commit r127596, it's not longer possible to use the gcc 4.2.1 libstdc++ while compiling c++0x code.

For instance, just including <vector> in a file make clang emit the following diagnostics.


--- test.cpp

#include <vector>

---------

% clang++ -std=c++0x -fsyntax-only test.cpp
In file included from test.cpp:2:
In file included from /usr/include/c++/4.2.1/vector:66:
In file included from /usr/include/c++/4.2.1/bits/allocator.h:53:
In file included from /usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/c++allocator.h:39:
In file included from /usr/include/c++/4.2.1/ext/new_allocator.h:37:
/usr/include/c++/4.2.1/new:95:7: error: exception specification in declaration does not match previous declaration
void* operator new(std::size_t) throw (std::bad_alloc);
      ^
note: previous declaration is here
/usr/include/c++/4.2.1/new:96:7: error: exception specification in declaration does not match previous declaration
void* operator new[](std::size_t) throw (std::bad_alloc);
      ^
note: previous declaration is here
2 errors generated.

I suppose this is a problem with libstdc++ 4.2.1 which is not standard compliant, but as it is widely used on OS X, maybe clang should do something to workaround the problem.


-- Jean-Daniel




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110315/1c14b38e/attachment.html>


More information about the cfe-dev mailing list