Hi all,

so let me give a more complete view on the current situation:
1) CentOS 7 comes with GCC 4.8.5 and the matching libstdc++. This works for most of C++11, but doesn't support C++14 nor C++17.
2) Our custom-built GCC modules (the latest being GCC 8.2.0) come with their corresponding versions of libstdc++, including support for newer C++ standards.
3) For Clang we want to enable using newer C++ standards, but having a dependency on a newer GCC causes all kinds of problems (What if we update GCC, do we need to rebuild Clang? Are there compatibility issues between Clang and libstdc++? What happens if a user loads a different GCC than we envisioned to be used with that particular version of Clang?) So we currently build and install a matching version of libc++ (LLVM's C++ library) and tell Clang to use its headers and shared library by default.
4) The Intel Compiler just uses whatever libstdc++ it can find. By default this will be the one from GCC 4.8.5, but by loading a newer GCC before the intel module you can use a more recent version (as Paul described last week).

So based on 3) I can successfully compile the std::optional example from https://en.cppreference.com/w/cpp/utility/optional (from a fresh environment with the default modules in each case):
# module switch intel clang
# $CXX -std=c++17 optional.cpp
This will use libc++ and everything is fine (as long as it's implemented in Clang 6.0 that's already one year old; there's an installation of Clang 7.0, but that's not the default yet).

Unfortunately just loading a newer GCC doesn't work for Clang, it will still use libstdc++ from GCC 4.8.5. You can override the GCC installation via a command line flag:
# module switch intel gcc/8
# module load clang
# $CXX -stdlib=libstdc++ --gcc-toolchain=$GCC_ROOT -std=c++17 optional.cpp
(Note that the order is important here: First load GCC and then Clang in a second step; this is basically equivalent to what Paul described last week using $ module purge)
The following also works:
# module switch intel clang
# $CXX -stdlib=libstdc++ --gcc-toolchain=/usr/local_rwth/sw/gcc/8.2.0/ -std=c++17 optional.cpp

Please note that this is not how we recommend using the Clang installation: We chose libc++ to avoid mismatches and all kinds of subtle errors I've described above. So while this setup might work, it's possible to break with the next set of module files and / or the next major update of either GCC or Clang.

Kind regards,
Jonas