From 04c5b99f38aef9a5c9627c35659891aecd8ab41e Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 4 Apr 2014 10:56:09 +0200 Subject: [PATCH] Features: Add cxx_user_literals. --- Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst | 5 +++++ Modules/Compiler/GNU-CXX-FeatureTests.cmake | 1 + Source/cmMakefile.cxx | 1 + Tests/CompileFeatures/cxx_user_literals.cpp | 7 +++++++ 4 files changed, 14 insertions(+) create mode 100644 Tests/CompileFeatures/cxx_user_literals.cpp diff --git a/Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst b/Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst index fbc45c2e6..1ea3b681b 100644 --- a/Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst +++ b/Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst @@ -122,6 +122,11 @@ The features known to this version of CMake are: .. _N2541: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2541.htm +``cxx_user_literals`` + User-defined literals, as defined in N2765_. + + .. _N2765: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2765.pdf + ``cxx_variadic_templates`` Variadic templates, as defined in N2242_. diff --git a/Modules/Compiler/GNU-CXX-FeatureTests.cmake b/Modules/Compiler/GNU-CXX-FeatureTests.cmake index 5f8d95231..12d2adc26 100644 --- a/Modules/Compiler/GNU-CXX-FeatureTests.cmake +++ b/Modules/Compiler/GNU-CXX-FeatureTests.cmake @@ -15,6 +15,7 @@ set(_cmake_feature_test_cxx_final "${GNU47_CXX11}") set(_cmake_feature_test_cxx_noexcept "${GNU47_CXX11}") set(_cmake_feature_test_cxx_nonstatic_member_init "${GNU47_CXX11}") set(_cmake_feature_test_cxx_override "${GNU47_CXX11}") +set(_cmake_feature_test_cxx_user_literals "${GNU47_CXX11}") # NOTE: C++11 was ratified in September 2011. GNU 4.7 is the first minor # release following that (March 2012), and the first minor release to # support -std=c++11. Prior to that, support for C++11 features is technically diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index fc89d8e7c..bcd192d76 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -64,6 +64,7 @@ F(cxx_static_assert) \ F(cxx_strong_enums) \ F(cxx_trailing_return_types) \ + F(cxx_user_literals) \ F(cxx_variadic_templates) class cmMakefile::Internals diff --git a/Tests/CompileFeatures/cxx_user_literals.cpp b/Tests/CompileFeatures/cxx_user_literals.cpp new file mode 100644 index 000000000..9e5a5889e --- /dev/null +++ b/Tests/CompileFeatures/cxx_user_literals.cpp @@ -0,0 +1,7 @@ + +long double operator "" _meters(long double); + +void someFunc() +{ + long double i = 1.2_meters; +}