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

Sebastian Redl sebastian.redl at getdesigned.at
Tue Mar 15 04:02:08 PDT 2011


On 15.03.2011 11:36, Jean-Daniel Dupas wrote:
> 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.
>
Yes, yes it should. That occurred to me too. The change in new's throw 
spec can definitely be a problem.

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


More information about the cfe-dev mailing list