Fix a problem when calling throw_with_nested with a class marked 'final'. Thanks to STL @ Microsoft for the bug report.
llvm-svn: 232384
Cr-Mirrored-From: sso://chromium.googlesource.com/_direct/external/github.com/llvm/llvm-project
Cr-Mirrored-Commit: b7361983d180fd14bd070c70542d30d631488ea0
diff --git a/include/exception b/include/exception
index cad802e..2d8c0f5 100644
--- a/include/exception
+++ b/include/exception
@@ -193,6 +193,9 @@
throw_with_nested(_Tp&& __t, typename enable_if<
is_class<typename remove_reference<_Tp>::type>::value &&
!is_base_of<nested_exception, typename remove_reference<_Tp>::type>::value
+#if _LIBCPP_STD_VER > 11
+ && !is_final<typename remove_reference<_Tp>::type>::value
+#endif
>::type* = 0)
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
throw_with_nested (_Tp& __t, typename enable_if<
@@ -212,6 +215,9 @@
throw_with_nested(_Tp&& __t, typename enable_if<
!is_class<typename remove_reference<_Tp>::type>::value ||
is_base_of<nested_exception, typename remove_reference<_Tp>::type>::value
+#if _LIBCPP_STD_VER > 11
+ || is_final<typename remove_reference<_Tp>::type>::value
+#endif
>::type* = 0)
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
throw_with_nested (_Tp& __t, typename enable_if<