It is my understanding that libc++ is fully C++03 compatible. Or is this not the case? (I couldn’t find this fact explicitly documented on libcxx.llvm.org).
Following the split of headers into and <foo.h> headers in [1], any compilation including <foo.h> will end up picking the libc++ header instead of directly including the underlying C library’s <foo.h> header. This can be a bit problematic for -std=c++03 in some cases. For example, <math.h> header provided by libc++ makes references C99 math functions unconditionally, which is OK for -std=c++11 and beyond, but not OK for -std=c++03. If the underlying C-library does not provide those C99 functions (as expected for -std=C++03), this usage will result in a compiler error.
Am I missing something here? We have a C library which is quite strict about standards conformance (e.g. it won’t make C99 math functions visible if being used under -std=c++03). Do we need to be more lenient with libc++? Or is this a regression from D12747?
If there is a common senses on this, I’d like to at least document in on libcxx.llvm.org.
It is my understanding that libc++ is fully C++03 compatible. Or is this not the case? (I couldn’t find this fact explicitly documented on libcxx.llvm.org).
We don’t provide a conforming C++03 mode.
Libc++ uses the C++11 as its base document. C++03 support is really just the C++11 STL without C++11 language features.
If the underlying C-library does not provide those C99 functions (as expected for -std=C++03), this usage will result in a compiler error.
That’s problematic. If a header exists in C++03 then users should be able to include it without error in C++03.
If certain C libraries require extra guards around C99 declarations then we should support that.
However most C libraries provide the C99 extensions in C++03 and libc++ should continue to provide them as well.
Do we need to be more lenient with libc++?
Probably not. I think we should fix libc++ to support strict C library implementations.
Or is this a regression from D12747?
I don’t think it’s a regression because we never provided strict C++03 conformance.
If there is a common senses on this, I’d like to at least document in on libcxx.llvm.org.