This adjusts the workaround from D104731.
The issue lies in libstdc++'s classes, not GCC itself, and manifests
itself in the same way if building e.g. with clang while using
libstdc++ headers from GCC 7 (e.g. if building with Clang on Ubuntu 18.04,
while using the system default C++ library).
Therefore, change the condition to look for the version of libstdc++
instead of the compiler.
You don't need to check whether _GLIBCXX_RELEASE is defined; if it is not, it'll be replaced with 0 and the test will fail anyway.