Skip to content

Commit

Permalink
Try using __builtin_unreachable instead.
Browse files Browse the repository at this point in the history
  • Loading branch information
mpark committed Sep 13, 2017
1 parent 0a931ef commit 5df16a3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 4 additions & 0 deletions include/mpark/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
#define MPARK_BUILTIN_ADDRESSOF
#endif

#if __has_builtin(__builtin_unreachable)
#define MPARK_BUILTIN_UNREACHABLE
#endif

#if __has_builtin(__type_pack_element)
#define MPARK_TYPE_PACK_ELEMENT
#endif
Expand Down
8 changes: 2 additions & 6 deletions include/mpark/variant.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,13 +247,9 @@ namespace mpark {
#ifdef MPARK_EXCEPTIONS
throw bad_variant_access{};
#else
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-noreturn"
#endif
std::terminate();
#ifdef __clang__
#pragma clang diagnostic pop
#ifdef MPARK_BUILTIN_UNREACHABLE
__builtin_unreachable();
#endif
#endif
}
Expand Down

0 comments on commit 5df16a3

Please sign in to comment.