From 5948e39297f73a90202a397c317b5c0e63a7fcde Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Thu, 13 Apr 2017 16:57:42 +0000 Subject: [PATCH] Implement LWG#2855 - made easy by previous refactoring llvm-svn: 300218 --- libcxx/include/exception | 4 ++-- .../except.nested/throw_with_nested.pass.cpp | 10 ++++++++++ libcxx/www/cxx1z_status.html | 4 ++-- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/libcxx/include/exception b/libcxx/include/exception index b12a4c2b26ef..181d604d6c1e 100644 --- a/libcxx/include/exception +++ b/libcxx/include/exception @@ -243,8 +243,8 @@ throw_with_nested (_Tp& __t) #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES { #ifndef _LIBCPP_NO_EXCEPTIONS - typedef typename remove_reference<_Tp>::type _Up; -// static_assert( is_copy_constructible<_Up>::value, ""); + typedef typename decay<_Tp>::type _Up; + static_assert( is_copy_constructible<_Up>::value, "type thrown must be CopyConstructible"); __throw_with_nested<_Tp, _Up, is_class<_Up>::value && !is_base_of::value && diff --git a/libcxx/test/std/language.support/support.exception/except.nested/throw_with_nested.pass.cpp b/libcxx/test/std/language.support/support.exception/except.nested/throw_with_nested.pass.cpp index a86d8bcbe201..26be4db38fba 100644 --- a/libcxx/test/std/language.support/support.exception/except.nested/throw_with_nested.pass.cpp +++ b/libcxx/test/std/language.support/support.exception/except.nested/throw_with_nested.pass.cpp @@ -107,6 +107,16 @@ int main() assert(i == 7); } } + { + try + { + std::throw_with_nested("String literal"); + assert(false); + } + catch (const char * s) + { + } + } #if TEST_STD_VER > 11 { try diff --git a/libcxx/www/cxx1z_status.html b/libcxx/www/cxx1z_status.html index 36c22508524f..d4fd8ec6200e 100644 --- a/libcxx/www/cxx1z_status.html +++ b/libcxx/www/cxx1z_status.html @@ -463,7 +463,7 @@ 2842in_place_t check for optional::optional(U&&) should decay UKonaComplete 2850std::function move constructor does unnecessary workKona 2853Possible inconsistency in specification of erase in [vector.modifiers]Kona - 2855std::throw_with_nested("string_literal")Kona + 2855std::throw_with_nested("string_literal")KonaComplete 2857{variant,optional,any}::emplace should return the constructed valueKona 2861basic_string should require that charT match traits::char_typeKonaComplete 2866Incorrect derived classes constraintsKona @@ -489,7 +489,7 @@ -

Last Updated: 11-Apr-2017

+

Last Updated: 13-Apr-2017