diff --git a/CHANGELOG.md b/CHANGELOG.md index 85bf37e..32b4ed7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ template: #### Fixes: - fixed `[dotted.table]` source columns sometimes being off by one (#152) (@vaartis) +- fixed spurious `Wnull-dereference` warning on GCC (#164) (@zaporozhets) - fixed `print_to_stream` ambiguity for `size_t` (#167) (@acronce) #### Additions: diff --git a/include/toml++/impl/preprocessor.h b/include/toml++/impl/preprocessor.h index ec46c3e..c9ee1f9 100644 --- a/include/toml++/impl/preprocessor.h +++ b/include/toml++/impl/preprocessor.h @@ -576,6 +576,7 @@ TOML_PRAGMA_GCC(diagnostic ignored "-Wmissing-field-initializers") \ TOML_PRAGMA_GCC(diagnostic ignored "-Wmaybe-uninitialized") \ TOML_PRAGMA_GCC(diagnostic ignored "-Wnoexcept") \ + TOML_PRAGMA_GCC(diagnostic ignored "-Wnull-dereference") \ static_assert(true) #define TOML_POP_WARNINGS \ diff --git a/include/toml++/impl/toml_formatter.inl b/include/toml++/impl/toml_formatter.inl index d2196a4..dc8d5ae 100644 --- a/include/toml++/impl/toml_formatter.inl +++ b/include/toml++/impl/toml_formatter.inl @@ -234,10 +234,13 @@ TOML_NAMESPACE_START TOML_EXTERNAL_LINKAGE void toml_formatter::print(const table& tbl) { - static constexpr auto is_non_inline_array_of_tables = [](auto&& nde) noexcept + static constexpr auto is_non_inline_array_of_tables = [](const node& n) noexcept { - auto arr = nde.as_array(); - return arr && arr->is_array_of_tables() && !arr->template get_as