Mapping between C++ Standard Version and libc++ Version

I am looking for the libc++ version which implements all of the libraries for the C++11 standard and only that standard.
I see from libc++ C++14 Status — libc++ documentation that, it appears, the C++14 standard became available in libc++ Version 3.4?
Does that mean llvm-project/libcxx/include at release/3.4.x · llvm/llvm-project · GitHub ?
If so, does that imply Version 3.0 (llvm-project/libcxx/include at release/3.0.x · llvm/llvm-project · GitHub) would represent a version of libc++ using only C++11 features?

I don’t think there is such a libc++ version. Different standard versions get implemented in parallel. e.g C++17, C++20 and C++23 are all getting implemented currently. Also, being feature complete doesn’t mean being bug-free. Why are you interested in that?

I am working on a project that checks conformance with specified C++ standards.
Without going into detail, I need a reference implementation of the libraries for each version.
Plain functions are easy as we are only concerned with the signatures so no (value correct) implementation is needed (only the types need to match).
Templated functions can (and do) change their return types based on their arguments, so and implementation is required.

You get that by compiling with -std=c++11, -std=c++14 etc. No need to use an ancient version.

Fair enough. I presume the -std=c++11 is implemented as some preprocessor instructions?
Is there a reference explaining the implementation of -std=X?

There are ifdefs for the various standards. So you probably want a current release for your work.

Cpp reference is commonly used as the reference:
https://en.cppreference.com/w/cpp/23

1 Like

Is there a document/source where the various #ifdefs are defined?

Do you mean llvm-project/__config at main · llvm/llvm-project · GitHub?

1 Like

Here is the PR for the implementation of std expected:
https://reviews.llvm.org/D124516

At the top of the files you will find

#if _LIBCPP_STD_VER >= 23

I think you’re asking about the __cplusplus predefined preprocessor symbol. The compiler sets this based on the -std argument, and the value is derived from the date of the standard; so for example -std=c++11 sets it to 201103L. Library implementations that support multiple versions (and most do) will use __cplusplus to pick and choose between features that vary across versions.

Things like _LIBCPP_STD_VER as @tschuett mentioned are internal implementation details of a given library, and not something a conformance test suite should be mucking around with.

1 Like

Thanks, I think that answers the question.

__cplusplus is used to select the version specific fragments.
The valid __cplusplus values.

The implementation makes use of _LIBCPP_STD_VER which is set, based on __cplusplus.