diff --git a/include/type_traits b/include/type_traits index 478b29bd1..63ab138b2 100644 --- a/include/type_traits +++ b/include/type_traits @@ -91,6 +91,7 @@ namespace std template struct is_empty; template struct is_polymorphic; template struct is_abstract; + template struct is_final; // C++14 template struct is_constructible; template struct is_default_constructible; @@ -759,6 +760,13 @@ template struct __libcpp_abstract<_Tp, false> : public false_type {} template struct _LIBCPP_TYPE_VIS_ONLY is_abstract : public __libcpp_abstract<_Tp> {}; +// is_final + +#if __has_feature(is_final) +template struct _LIBCPP_TYPE_VIS_ONLY +is_final : public integral_constant {}; +#endif + // is_base_of #ifdef _LIBCPP_HAS_IS_BASE_OF diff --git a/test/utilities/meta/meta.unary/meta.unary.prop/is_final.pass.cpp b/test/utilities/meta/meta.unary/meta.unary.prop/is_final.pass.cpp new file mode 100644 index 000000000..2f69c743e --- /dev/null +++ b/test/utilities/meta/meta.unary/meta.unary.prop/is_final.pass.cpp @@ -0,0 +1,53 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// is_final + +#include + +#if __cplusplus >= 201103L + +struct P final { }; +union U1 { }; +union U2 final { }; + +template +void test_is_final() +{ + static_assert( std::is_final::value, ""); + static_assert( std::is_final::value, ""); + static_assert( std::is_final::value, ""); + static_assert( std::is_final::value, ""); +} + +template +void test_is_not_final() +{ + static_assert(!std::is_final::value, ""); + static_assert(!std::is_final::value, ""); + static_assert(!std::is_final::value, ""); + static_assert(!std::is_final::value, ""); +} + +int main () +{ + test_is_not_final(); + test_is_not_final(); + test_is_final

(); + test_is_not_final(); + test_is_not_final(); + test_is_not_final(); + test_is_final (); + test_is_not_final(); +} +#else +int main () {} +#endif diff --git a/www/cxx1y_status.html b/www/cxx1y_status.html index 9bd758eaf..e8df3476b 100644 --- a/www/cxx1y_status.html +++ b/www/cxx1y_status.html @@ -230,7 +230,7 @@ 1450Contradiction in regex_constantsIssaquahComplete 2003String exception inconsistency in erase.IssaquahComplete - 2112User-defined classes that cannot be derived fromIssaquah + 2112User-defined classes that cannot be derived fromIssaquahComplete 2132std::function ambiguityIssaquah 2182Container::[const_]reference types are misleadingly specifiedIssaquahComplete 2188Reverse iterator does not fully support targets that overload operator&IssaquahComplete @@ -255,7 +255,7 @@ 2323vector::resize(n, t)'s specification should be simplifiedIssaquahComplete 2324Insert iterator constructors should use addressof()IssaquahComplete 2329regex_match()/regex_search() with match_results should forbid temporary stringsIssaquahComplete - 2330regex("meow", regex::icase) is technically forbidden but should be permittedIssaquah + 2330regex("meow", regex::icase) is technically forbidden but should be permittedIssaquahComplete 2332regex_iterator/regex_token_iterator should forbid temporary regexesIssaquahComplete 2339Wording issue in nth_elementIssaquahComplete 2341Inconsistency between basic_ostream::seekp(pos) and basic_ostream::seekp(off, dir)IssaquahComplete