Author: marshall
Date: Tue Mar 14 12:08:47 2017
New Revision: 297752

URL: http://llvm.org/viewvc/llvm-project?rev=297752&view=rev
Log:
Implement LWG2784, and mark 2786, 2795, 2804, 2812, 2826, 2834, 2837 and 2838 
as complete - since we do them already

Modified:
    libcxx/trunk/include/exception
    
libcxx/trunk/test/std/language.support/support.exception/except.nested/rethrow_if_nested.pass.cpp
    libcxx/trunk/www/cxx1z_status.html

Modified: libcxx/trunk/include/exception
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/exception?rev=297752&r1=297751&r2=297752&view=diff
==============================================================================
--- libcxx/trunk/include/exception (original)
+++ libcxx/trunk/include/exception Tue Mar 14 12:08:47 2017
@@ -248,12 +248,17 @@ throw_with_nested (_Tp& __t, typename en
 #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, typena
 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)
 {
 }
 

Modified: 
libcxx/trunk/test/std/language.support/support.exception/except.nested/rethrow_if_nested.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.exception/except.nested/rethrow_if_nested.pass.cpp?rev=297752&r1=297751&r2=297752&view=diff
==============================================================================
--- 
libcxx/trunk/test/std/language.support/support.exception/except.nested/rethrow_if_nested.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/language.support/support.exception/except.nested/rethrow_if_nested.pass.cpp
 Tue Mar 14 12:08:47 2017
@@ -46,16 +46,47 @@ public:
        C * operator&() const { assert(false); } // should not be called
 };
 
+class D : private std::nested_exception {};
+
+
+class E1 : public std::nested_exception {};
+class E2 : public std::nested_exception {};
+class E : public E1, public E2 {};
+
 int main()
 {
     {
         try
         {
-            A a(3);
+            A a(3);  // not a polymorphic type --> no effect
             std::rethrow_if_nested(a);
             assert(true);
         }
         catch (...)
+        {
+            assert(false);
+        }
+    }
+    {
+        try
+        {
+            D s;  // inaccessible base class --> no effect
+            std::rethrow_if_nested(s);
+            assert(true);
+        }
+        catch (...)
+        {
+            assert(false);
+        }
+    }
+    {
+        try
+        {
+            E s;  // ambiguous base class --> no effect
+            std::rethrow_if_nested(s);
+            assert(true);
+        }
+        catch (...)
         {
             assert(false);
         }

Modified: libcxx/trunk/www/cxx1z_status.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/cxx1z_status.html?rev=297752&r1=297751&r2=297752&view=diff
==============================================================================
--- libcxx/trunk/www/cxx1z_status.html (original)
+++ libcxx/trunk/www/cxx1z_status.html Tue Mar 14 12:08:47 2017
@@ -436,28 +436,28 @@
        <tr><td><a href="http://wg21.link/LWG2769";>2769</a></td><td>Redundant 
const in the return type of any_cast(const 
any&amp;)</td><td>Kona</td><td>Complete</td></tr>
        <tr><td><a 
href="http://wg21.link/LWG2781";>2781</a></td><td>Contradictory requirements for 
std::function and std::reference_wrapper</td><td>Kona</td><td>Complete</td></tr>
        <tr><td><a 
href="http://wg21.link/LWG2782";>2782</a></td><td>scoped_allocator_adaptor 
constructors must be constrained</td><td>Kona</td><td></td></tr>
-       <tr><td><a href="http://wg21.link/LWG2784";>2784</a></td><td>Resolution 
to LWG 2484 is missing "otherwise, no effects" and is hard to 
parse</td><td>Kona</td><td></td></tr>
+       <tr><td><a href="http://wg21.link/LWG2784";>2784</a></td><td>Resolution 
to LWG 2484 is missing "otherwise, no effects" and is hard to 
parse</td><td>Kona</td><td>Complete</td></tr>
        <tr><td><a href="http://wg21.link/LWG2785";>2785</a></td><td>quoted 
should work with basic_string_view</td><td>Kona</td><td></td></tr>
-       <tr><td><a href="http://wg21.link/LWG2786";>2786</a></td><td>Annex C 
should mention shared_ptr changes for array 
support</td><td>Kona</td><td></td></tr>
+       <tr><td><a href="http://wg21.link/LWG2786";>2786</a></td><td>Annex C 
should mention shared_ptr changes for array 
support</td><td>Kona</td><td>Complete</td></tr>
        <tr><td><a 
href="http://wg21.link/LWG2787";>2787</a></td><td>&sect;[file_status.cons] 
doesn't match class definition</td><td>Kona</td><td>Complete</td></tr>
        <tr><td><a 
href="http://wg21.link/LWG2788";>2788</a></td><td>basic_string range mutators 
unintentionally require a default constructible 
allocator</td><td>Kona</td><td></td></tr>
        <tr><td><a href="http://wg21.link/LWG2789";>2789</a></td><td>Equivalence 
of contained objects</td><td>Kona</td><td>Complete</td></tr>
        <tr><td><a href="http://wg21.link/LWG2790";>2790</a></td><td>Missing 
specification of 
istreambuf_iterator::operator-&gt;</td><td>Kona</td><td></td></tr>
        <tr><td><a href="http://wg21.link/LWG2794";>2794</a></td><td>Missing 
requirements for allocator pointers</td><td>Kona</td><td></td></tr>
-       <tr><td><a 
href="http://wg21.link/LWG2795";>2795</a></td><td>&sect;[global.functions] 
provides incorrect example of ADL use</td><td>Kona</td><td></td></tr>
+       <tr><td><a 
href="http://wg21.link/LWG2795";>2795</a></td><td>&sect;[global.functions] 
provides incorrect example of ADL use</td><td>Kona</td><td>Complete</td></tr>
        <tr><td><a href="http://wg21.link/LWG2796";>2796</a></td><td>tuple 
should be a literal type</td><td>Kona</td><td></td></tr>
        <tr><td><a 
href="http://wg21.link/LWG2801";>2801</a></td><td>Default-constructibility of 
unique_ptr</td><td>Kona</td><td></td></tr>
        <tr><td><a href="http://wg21.link/LWG2802";>2802</a></td><td>shared_ptr 
constructor requirements for a deleter</td><td>Kona</td><td></td></tr>
-       <tr><td><a 
href="http://wg21.link/LWG2804";>2804</a></td><td>Unconditional constexpr 
default constructor for istream_iterator</td><td>Kona</td><td></td></tr>
+       <tr><td><a 
href="http://wg21.link/LWG2804";>2804</a></td><td>Unconditional constexpr 
default constructor for istream_iterator</td><td>Kona</td><td>Complete</td></tr>
        <tr><td><a href="http://wg21.link/LWG2806";>2806</a></td><td>Base class 
of bad_optional_access</td><td>Kona</td><td>Complete</td></tr>
        <tr><td><a href="http://wg21.link/LWG2807";>2807</a></td><td>std::invoke 
should use std::is_nothrow_callable</td><td>Kona</td><td></td></tr>
-       <tr><td><a href="http://wg21.link/LWG2812";>2812</a></td><td>Range 
access is available with &lt;string_view&gt;</td><td>Kona</td><td></td></tr>
+       <tr><td><a href="http://wg21.link/LWG2812";>2812</a></td><td>Range 
access is available with 
&lt;string_view&gt;</td><td>Kona</td><td>Complete</td></tr>
        <tr><td><a href="http://wg21.link/LWG2824";>2824</a></td><td>list::sort 
should say that the order of elements is unspecified if an exception is 
thrown</td><td>Kona</td><td></td></tr>
-       <tr><td><a href="http://wg21.link/LWG2826";>2826</a></td><td>string_view 
iterators use old wording</td><td>Kona</td><td></td></tr>
-       <tr><td><a href="http://wg21.link/LWG2834";>2834</a></td><td>Resolution 
LWG 2223 is missing wording about end iterators</td><td>Kona</td><td></td></tr>
+       <tr><td><a href="http://wg21.link/LWG2826";>2826</a></td><td>string_view 
iterators use old wording</td><td>Kona</td><td>Complete</td></tr>
+       <tr><td><a href="http://wg21.link/LWG2834";>2834</a></td><td>Resolution 
LWG 2223 is missing wording about end 
iterators</td><td>Kona</td><td>Complete</td></tr>
        <tr><td><a href="http://wg21.link/LWG2835";>2835</a></td><td>LWG 2536 
seems to misspecify &lt;tgmath.h&gt;</td><td>Kona</td><td></td></tr>
-       <tr><td><a href="http://wg21.link/LWG2837";>2837</a></td><td>gcd and lcm 
should support a wider range of input values</td><td>Kona</td><td></td></tr>
-       <tr><td><a 
href="http://wg21.link/LWG2838";>2838</a></td><td>is_literal_type specification 
needs a little cleanup</td><td>Kona</td><td></td></tr>
+       <tr><td><a href="http://wg21.link/LWG2837";>2837</a></td><td>gcd and lcm 
should support a wider range of input 
values</td><td>Kona</td><td>Complete</td></tr>
+       <tr><td><a 
href="http://wg21.link/LWG2838";>2838</a></td><td>is_literal_type specification 
needs a little cleanup</td><td>Kona</td><td>Complete</td></tr>
        <tr><td><a href="http://wg21.link/LWG2842";>2842</a></td><td>in_place_t 
check for optional::optional(U&amp;&amp;) should decay 
U</td><td>Kona</td><td></td></tr>
        <tr><td><a 
href="http://wg21.link/LWG2850";>2850</a></td><td>std::function move constructor 
does unnecessary work</td><td>Kona</td><td></td></tr>
        <tr><td><a href="http://wg21.link/LWG2853";>2853</a></td><td>Possible 
inconsistency in specification of erase in 
[vector.modifiers]</td><td>Kona</td><td></td></tr>


_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to