Features: Add cxx_unrestricted_unions.

This commit is contained in:
Stephen Kelly 2014-04-04 11:06:02 +02:00
parent 3322b393a2
commit 9064f78b0c
4 changed files with 18 additions and 0 deletions

View File

@ -127,6 +127,11 @@ The features known to this version of CMake are:
.. _N2442: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2442.htm
``cxx_unrestricted_unions``
Unrestricted unions, as defined in N2544_.
.. _N2544: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2544.pdf
``cxx_user_literals``
User-defined literals, as defined in N2765_.

View File

@ -26,6 +26,7 @@ set(GNU46_CXX11 "${_oldestSupported} && __cplusplus >= 201103L")
set(_cmake_feature_test_cxx_constexpr "${GNU46_CXX11}")
set(_cmake_feature_test_cxx_nullptr "${GNU46_CXX11}")
set(_cmake_feature_test_cxx_range_for "${GNU46_CXX11}")
set(_cmake_feature_test_cxx_unrestricted_unions "${GNU46_CXX11}")
# TODO: Should be supported by GNU 4.5
set(GNU45_CXX11 "${_oldestSupported} && __cplusplus >= 201103L")
set(_cmake_feature_test_cxx_explicit_conversions "${GNU45_CXX11}")

View File

@ -65,6 +65,7 @@
F(cxx_strong_enums) \
F(cxx_trailing_return_types) \
F(cxx_unicode_literals) \
F(cxx_unrestricted_unions) \
F(cxx_user_literals) \
F(cxx_variadic_templates)

View File

@ -0,0 +1,11 @@
struct point {
point() {}
point(int x, int y) : x_(x), y_(y) {}
int x_, y_;
};
union u {
point p_;
int i_;
const char* s_;
};