diff --git a/test/compile-error-test/CMakeLists.txt b/test/compile-error-test/CMakeLists.txt index c4a160688d4c..495f659859af 100644 --- a/test/compile-error-test/CMakeLists.txt +++ b/test/compile-error-test/CMakeLists.txt @@ -177,6 +177,12 @@ set(CMAKE_REQUIRED_FLAGS ) if (NOT SUPPORTS_USER_DEFINED_LITERALS) set (SUPPORTS_USER_DEFINED_LITERALS OFF) endif () +if (SUPPORTS_USER_DEFINED_LITERALS AND CMAKE_COMPILER_IS_GNUCXX) + # GCC before 4.9 is not supported for user-defined literals as it requires an + # invalid syntax in their definition. + set (SUPPORTS_USER_DEFINED_LITERALS + $,4.9.0>,OFF,ON> +endif() # Make sure that compiler features detected in the header # match the features detected in CMake.