From 1889045ca672e295c18203401c27a9e62ff45424 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 6 Apr 2014 10:09:37 +0200 Subject: [PATCH] Features: Add cxx_sizeof_member. --- Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst | 5 +++++ Modules/Compiler/GNU-CXX-FeatureTests.cmake | 1 + Source/cmMakefile.cxx | 1 + Tests/CompileFeatures/cxx_sizeof_member.cpp | 10 ++++++++++ 4 files changed, 17 insertions(+) create mode 100644 Tests/CompileFeatures/cxx_sizeof_member.cpp diff --git a/Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst b/Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst index b544d7e19..a16dced0a 100644 --- a/Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst +++ b/Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst @@ -137,6 +137,11 @@ The features known to this version of CMake are: .. _N2118: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n2118.html +``cxx_sizeof_member`` + Size of non-static data members, as defined in N2253_. + + .. _N2253: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2253.html + ``cxx_static_assert`` Static assert, as defined in N1720_. diff --git a/Modules/Compiler/GNU-CXX-FeatureTests.cmake b/Modules/Compiler/GNU-CXX-FeatureTests.cmake index 1f56aceb7..a98ae3ac9 100644 --- a/Modules/Compiler/GNU-CXX-FeatureTests.cmake +++ b/Modules/Compiler/GNU-CXX-FeatureTests.cmake @@ -43,6 +43,7 @@ set(_cmake_feature_test_cxx_defaulted_functions "${GNU44_CXX11}") set(_cmake_feature_test_cxx_deleted_functions "${GNU44_CXX11}") set(_cmake_feature_test_cxx_generalized_initializers "${GNU44_CXX11}") set(_cmake_feature_test_cxx_inline_namespaces "${GNU44_CXX11}") +set(_cmake_feature_test_cxx_sizeof_member "${GNU44_CXX11}") set(_cmake_feature_test_cxx_strong_enums "${GNU44_CXX11}") set(_cmake_feature_test_cxx_trailing_return_types "${GNU44_CXX11}") set(_cmake_feature_test_cxx_unicode_literals "${GNU44_CXX11}") diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 6d2a5766b..58c874d5c 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -67,6 +67,7 @@ F(cxx_raw_string_literals) \ F(cxx_reference_qualified_functions) \ F(cxx_rvalue_references) \ + F(cxx_sizeof_member) \ F(cxx_static_assert) \ F(cxx_strong_enums) \ F(cxx_thread_local) \ diff --git a/Tests/CompileFeatures/cxx_sizeof_member.cpp b/Tests/CompileFeatures/cxx_sizeof_member.cpp new file mode 100644 index 000000000..ae143d26f --- /dev/null +++ b/Tests/CompileFeatures/cxx_sizeof_member.cpp @@ -0,0 +1,10 @@ + +struct A +{ + int m_i; +}; + +int someFunc() +{ + return sizeof(A::m_i) > 0 ? 1 : 2; +}