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

Weiming Zhao via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 23 21:02:12 PDT 2016


weimingz created this revision.
weimingz added a subscriber: cfe-commits.

this fixes build error when built with c++14 and no exceptions

http://reviews.llvm.org/D21673

Files:
  include/experimental/optional

Index: include/experimental/optional
===================================================================
--- include/experimental/optional
+++ include/experimental/optional
@@ -517,7 +517,11 @@
     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_;
     }
 
@@ -525,7 +529,11 @@
     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.61755.patch
Type: text/x-patch
Size: 709 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160624/ced85164/attachment.bin>


More information about the cfe-commits mailing list