mclow.lists added a comment.

I just realized that this will break the following code:

  try {  __cxxabiv1:: __cxa_bad_cast(); }
  catch ( std::bad_cast &ex ) {}

because what gets thrown is a `const std::bad_cast &`

Yes, people should catch by value or const reference.
But that doesn't mean that they always do.


================
Comment at: include/exception:262
@@ -261,3 +261,3 @@
 _LIBCPP_INLINE_VISIBILITY
-inline void __libcpp_throw(_Exception const& __e) {
+inline __attribute__((noreturn)) void __libcpp_throw(_Exception const& __e) {
 #ifndef _LIBCPP_NO_EXCEPTIONS
----------------
weimingz wrote:
> mclow.lists wrote:
> > I thought that we were going to add a macro for the "no return if no 
> > exceptions"
> something like this?
> 
> #ifndef __LIBCPP_NO_EXCEPTIONS
>   #define NORETURN_EXP __attribute__((noreturn))
> #else
>   #define NORETURN_EXP
> #endif
> 
> inline NORETURN_EXP void __libcpp_throw(_Exception const& __e) {
>   ...
> }
There's another patch out for review that adds `noreturn` attributes for some 
functions when exceptions are disabled. I suggested a macro name like 
`_LIBCPP_NO_RETURN_WHEN_EXCEPTIONS_DISABLED` for this instead of using the 
`[[noreturn]]` or `__attribute__((noreturn)) `.

I can't find the review at the moment, but I'll turn it up.


http://reviews.llvm.org/D21706



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

Reply via email to