How to detect the libstdc++ version in Clang?

Clang does come with its own standard library implementation, it's called libc++. You can use it by adding -stdlib=libc++ to your compile command.

That being said, there are various ways to check Clang/libstdc++ C++ support:

  1. Clang has the __has_feature macro (and friends) that can be used to detect language features and language extenstions.
  2. Libstdc++ has its own version macros, see the documentation. You'll need to include a libstdc++ header to get these defined though.
  3. GCC has its version macros which you already discovered, but those would need to be manually compared to the documentation.

And also, this took me 2 minutes of googling.