[cfe-dev] Using c++11 features in clang

Marshall Clow mclow.lists at gmail.com
Thu Jul 5 12:50:06 PDT 2012


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:
>> 	http://marshall.calepin.co/llvmclang-and-standard-libraries-on-mac-os-x.html
>> 
>> 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.

Yes.

> 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.

-- Marshall

Marshall Clow     Idio Software   <mailto:mclow.lists at gmail.com>

A.D. 1517: Martin Luther nails his 95 Theses to the church door and is promptly moderated down to (-1, Flamebait).
        -- Yu Suzuki





More information about the cfe-dev mailing list