[PATCH] D21673: [libcxx] guard throw with exception enabling check
Noel Grandin via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 24 01:25:58 PDT 2016
grandinj added a subscriber: grandinj.
================
Comment at: include/experimental/optional:524
@@ -521,1 +523,3 @@
+ assert(!"bad optional access");
+#endif
return this->__val_;
----------------
If this kind of code is going to show up in lots of places, then maybe wrap it up in a macro:
_LIBCPP_THROW_OR_ASSERT(bad_optional_access(), "bad optional access")
?
With some extra preprocessor magic, and if LLVM didn't care about the string in the assert, could even leave out the second parameter
http://reviews.llvm.org/D21673
More information about the cfe-commits
mailing list