Skip to content

Commit 30868f8

Browse files
authored
Merge pull request #392 from biojppm/fix/gcc9_compile_error
Fix compile error with gcc 9: use of [[unlikely]]
2 parents 9371986 + 8e6edc8 commit 30868f8

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

include/fast_float/float_common.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,11 @@ using parse_options = parse_options_t<char>;
207207
// to a no-op elsewhere (e.g. pre-C++20 MSVC, which has no equivalent hint).
208208
#ifdef __has_cpp_attribute
209209
#if __has_cpp_attribute(unlikely) >= 201803L
210-
#define FASTFLOAT_USE_UNLIKELY_ATTR 1
210+
// g++-9 hits hits this branch, but then fails to compile
211+
// [[unlikely]]. This happens only with g++-9.
212+
#if !defined(__GNUC__) || (__GNUC__ != 9)
213+
#define FASTFLOAT_USE_UNLIKELY_ATTR
214+
#endif
211215
#endif
212216
#endif
213217

0 commit comments

Comments
 (0)