[cfe-dev] Using c++11 features in clang
eli.friedman at gmail.com
Thu Jul 5 13:09:53 PDT 2012
On Thu, Jul 5, 2012 at 12:50 PM, Marshall Clow <mclow.lists at gmail.com> wrote:
> On Jul 5, 2012, at 12:41 PM, Joseph Galbraith wrote:
>> On 07/05/2012 12:29, Marshall Clow wrote:
>>> In response to a some questions on the boost-users list (and boost bug reports), I wrote up this:
>>> I don't know if this should be a FAQ entry for Boost, or for clang.
>>> Suggestions/comments/edits welcome.
>> Isn't one of both of -std=c++11 and -stdlib=libc++ an ABI change?
>> If so, it should probably be noted that all code should be build with
>> the same settings for these flags.
>> In particular, I think that you can't pass a std:: classes from libstdc++
>> built code to libc++ code without bad things happening.
> I would expect that also, but libc++ has versioned namespaces that _should_ prevent that from happening (I.e, cause linker errors).
>> I'm not sure whether just turning whether the following is safe or not:
>> clang++ -c -stdlib=libc++ x.cpp
>> clang++ -c -stdlib=libc++ -std=c++11 y.cpp
>> clang++ -stdlib=libc++ x.o y.o
> I would expect either:
> * It would "just work"
> * It would fail to link
> depending on what the contents of x.cpp and y.cpp were.
> If you can come up with a good way of explaining this, I'll be happy to add it to my post.
On OSX specifically, code compiled with -std=c++11 should generally be
ABI-compatible with code compiled with -std=c++98. Code compiled with
-stdlib=libc++ generally isn't ABI-compatible with code compiled with
More information about the cfe-dev