From 7e748417bc8e06caa8eb0b6a6258b7d24cc22bfb Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 3 Apr 2014 00:08:49 +0200 Subject: [PATCH] Features: Add cxx_decltype. --- Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst | 5 +++++ Modules/Compiler/GNU-CXX-FeatureTests.cmake | 1 + Source/cmMakefile.cxx | 1 + Tests/CompileFeatures/cxx_decltype.cpp | 7 +++++++ 4 files changed, 14 insertions(+) create mode 100644 Tests/CompileFeatures/cxx_decltype.cpp diff --git a/Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst b/Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst index 4a685730f..97689dcb2 100644 --- a/Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst +++ b/Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst @@ -22,6 +22,11 @@ The features known to this version of CMake are: .. _N2235: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2235.pdf +``cxx_decltype`` + Decltype, as defined in N2343_. + + .. _N2343: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2343.pdf + ``cxx_delegating_constructors`` Delegating constructors, as defined in N1986_. diff --git a/Modules/Compiler/GNU-CXX-FeatureTests.cmake b/Modules/Compiler/GNU-CXX-FeatureTests.cmake index c451b7e0d..de328c438 100644 --- a/Modules/Compiler/GNU-CXX-FeatureTests.cmake +++ b/Modules/Compiler/GNU-CXX-FeatureTests.cmake @@ -30,5 +30,6 @@ set(_cmake_feature_test_cxx_variadic_templates "${GNU44_CXX11}") # http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2555.pdf # TODO: Should be supported by GNU 4.3 set(GNU43_CXX11 "${_oldestSupported} && __cplusplus >= 201103L") +set(_cmake_feature_test_cxx_decltype "${GNU43_CXX11}") set(_cmake_feature_test_cxx_static_assert "${GNU43_CXX11}") set(_oldestSupported) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 12d88e41e..6ce3c16b1 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -44,6 +44,7 @@ #define FOR_EACH_CXX_FEATURE(F) \ F(cxx_auto_type) \ F(cxx_constexpr) \ + F(cxx_decltype) \ F(cxx_delegating_constructors) \ F(cxx_final) \ F(cxx_override) \ diff --git a/Tests/CompileFeatures/cxx_decltype.cpp b/Tests/CompileFeatures/cxx_decltype.cpp new file mode 100644 index 000000000..24ec51e84 --- /dev/null +++ b/Tests/CompileFeatures/cxx_decltype.cpp @@ -0,0 +1,7 @@ + +int someFunc() +{ + int i = 0; + decltype(i) other = 0; + return other; +}