summaryrefslogtreecommitdiffstats
path: root/libcxx/include/exception
diff options
context:
space:
mode:
authorMarshall Clow <mclow.lists@gmail.com>2017-03-14 17:08:47 +0000
committerMarshall Clow <mclow.lists@gmail.com>2017-03-14 17:08:47 +0000
commit55cfe4c16beba63d5cd5647da6349fbb886ece08 (patch)
tree347cdffbe84e0ff7ccbbbcb9784d17e8da80b564 /libcxx/include/exception
parentb9d8062eda0204206dbf149b52c0a13238e57a78 (diff)
downloadbcm5719-llvm-55cfe4c16beba63d5cd5647da6349fbb886ece08.tar.gz
bcm5719-llvm-55cfe4c16beba63d5cd5647da6349fbb886ece08.zip
Implement LWG2784, and mark 2786, 2795, 2804, 2812, 2826, 2834, 2837 and 2838 as complete - since we do them already
llvm-svn: 297752
Diffstat (limited to 'libcxx/include/exception')
-rw-r--r--libcxx/include/exception16
1 files changed, 10 insertions, 6 deletions
diff --git a/libcxx/include/exception b/libcxx/include/exception
index 8828709f8d5..216ae0c708e 100644
--- a/libcxx/include/exception
+++ b/libcxx/include/exception
@@ -248,12 +248,17 @@ throw_with_nested (_Tp& __t, typename enable_if<
#endif
}
+template <class _From, class _To>
+struct __can_dynamic_cast : public _LIBCPP_BOOL_CONSTANT(
+ is_polymorphic<_From>::value &&
+ (!is_base_of<_To, _From>::value ||
+ is_convertible<const _From*, const _To*>::value)) {};
+
template <class _Ep>
inline _LIBCPP_INLINE_VISIBILITY
void
-rethrow_if_nested(const _Ep& __e, typename enable_if<
- is_polymorphic<_Ep>::value
- >::type* = 0)
+rethrow_if_nested(const _Ep& __e,
+ typename enable_if< __can_dynamic_cast<_Ep, nested_exception>::value>::type* = 0)
{
const nested_exception* __nep = dynamic_cast<const nested_exception*>(_VSTD::addressof(__e));
if (__nep)
@@ -263,9 +268,8 @@ rethrow_if_nested(const _Ep& __e, typename enable_if<
template <class _Ep>
inline _LIBCPP_INLINE_VISIBILITY
void
-rethrow_if_nested(const _Ep&, typename enable_if<
- !is_polymorphic<_Ep>::value
- >::type* = 0)
+rethrow_if_nested(const _Ep&,
+ typename enable_if<!__can_dynamic_cast<_Ep, nested_exception>::value>::type* = 0)
{
}
OpenPOWER on IntegriCloud