Skip to content

Commit

Permalink
Don't use [[likely]] in C++ 20 if on clang's before 12.
Browse files Browse the repository at this point in the history
  • Loading branch information
ned14 committed Feb 23, 2021
1 parent 9ec7fe7 commit 10f1a12
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/outcome/try.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ OUTCOME_V2_NAMESPACE_END
_OUTCOME_TRY_OVERLOAD_GLUE(_OUTCOME_TRY_OVERLOAD_MACRO(name, _OUTCOME_TRY_COUNT_ARGS_MAX8(__VA_ARGS__)), (__VA_ARGS__))

#ifndef OUTCOME_TRY_LIKELY_IF
#if __cplusplus >= 202000L || _HAS_CXX20
#if(__cplusplus >= 202000L || _HAS_CXX20) && (!defined(__clang__) || __clang_major__ >= 12)
#define OUTCOME_TRY_LIKELY_IF(...) if(__VA_ARGS__) [[likely]]
#elif defined(__clang__) || defined(__GNUC__)
#define OUTCOME_TRY_LIKELY_IF(...) if(__builtin_expect(!!(__VA_ARGS__), true))
Expand Down

0 comments on commit 10f1a12

Please sign in to comment.