Fix build with -Og -Werror=maybe-uninitialized on GCC 7.2.0

It's getting tempting to just suppress -Wmaybe-uninitialized globally...
This commit is contained in:
Jyrki Vesterinen 2017-10-20 20:58:30 +03:00
parent d063aa077a
commit d480df850a

View file

@ -124,6 +124,16 @@ struct bad_lexical_cast : std::exception
namespace implementation {
/* Suppress -Wmaybe-uninitialized warnings.
* I (Jyrki) noticed that building with -Og on my system (GCC 7.2.0, Boost 1.61)
* GCC may omit a warning that the value of `fallback` may be used uninitialized.
* It's impossible, but GCC can't prove that to itself.
*/
#if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
#endif
/**
* Base class for the conversion.
*
@ -485,6 +495,10 @@ struct lexical_caster<
}
};
#if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic pop
#endif
} // namespace implementation
#endif