[PATCH] D21673: [libcxx] guard throw with exception enabling check

Weiming Zhao via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 24 11:09:25 PDT 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL273697: [libcxx] guard throw with exception enabling check (authored by weimingz).

Changed prior to commit:
  http://reviews.llvm.org/D21673?vs=61755&id=61813#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D21673

Files:
  libcxx/trunk/include/experimental/optional

Index: libcxx/trunk/include/experimental/optional
===================================================================
--- libcxx/trunk/include/experimental/optional
+++ libcxx/trunk/include/experimental/optional
@@ -517,15 +517,23 @@
     constexpr value_type const& value() const
     {
         if (!this->__engaged_)
+#ifndef _LIBCPP_NO_EXCEPTIONS
             throw bad_optional_access();
+#else
+            assert(!"bad optional access");
+#endif
         return this->__val_;
     }
 
     _LIBCPP_INLINE_VISIBILITY
     value_type& value()
     {
         if (!this->__engaged_)
+#ifndef _LIBCPP_NO_EXCEPTIONS
             throw bad_optional_access();
+#else
+            assert(!"bad optional access");
+#endif
         return this->__val_;
     }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D21673.61813.patch
Type: text/x-patch
Size: 759 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160624/77dc1e05/attachment.bin>


More information about the cfe-commits mailing list