We don't pretend to implement a "C++03 library"; no libc++ user should ever be relying on the fact that e.g. `emplace_back` does NOT exist. We support GCC only with `-std=c++11` and later. We support Clang in `-std=c++03` mode, but Clang supports rvalue references, defaulted member functions, NSDMIs, and variadic templates all as extensions to C++03. Conclusion: Several instances of _LIBCPP_CXX03_LANG are unnecessary. However, it's still true that in `-std=c++03` mode we're not allowed to use - `std::initializer_list` - braces around member-initializers - the `constexpr` or `noexcept` keywords And I don't think we want to turn on user-visible move constructors; e.g. today in `-std=c++03` mode, std::vector<T> v(1); auto w = std::move(v); visibly calls T's copy ctor. I think it would be reckless to change that, at least in this particular patch.
Thinking about this some more, I believe we need to figure out what to do with the tests. As it stands, this patch doesn't modify the tests at all, which means that the C++11 functionality that will be enabled in C++03 by this patch will never get tested.
One way to go would be to change some UNSUPPORTED: c++03 to UNSUPPORTED: c++03 && !libc++ to acknowledge that we're supporting this in libc++ as an extension.
@ldionne: My impression is that your testing concern applies:
- YES to things like vector::emplace_back
- NO to the changes in <bitset>
- MAYBE to things like vector::push_back(value_type&&)
I think the precedent here is std/utilities/utility/forward/move.pass.cpp — libc++ supports std::move in C++03 as an extension, so our tests for std::move do not say UNSUPPORTED: c++03. Instead, they say nothing: the test is simply supported in all modes. I can go through the tests for these facilities and remove UNSUPPORTED: c++03 where I see it; for example, in std/containers//sequences/deque/deque.modifiers/emplace_back.pass.cpp.
It doesn't make sense to add UNSUPPORTED: c++03 && !libc++ to new code; this is the libc++ test suite, and we do not run it on any other "C++03" libraries. Any other library tested with this test suite should be C++11-or-later already.
I'll also split out the "implementation" changes, that don't have any effects on libcxx/test/, into a separate commit/PR.