From db04ac8918d5e1132b6375be9841d58565a5ce4f Mon Sep 17 00:00:00 2001 From: Mark Gillard Date: Sat, 23 Apr 2022 17:28:25 +0300 Subject: [PATCH] added tests for `visit()` Also some minor refactors. --- CHANGELOG.md | 48 ++++++ CONTRIBUTING.md | 3 + README.md | 2 +- docs/poxy.toml | 6 +- include/toml++/impl/node.h | 4 - include/toml++/impl/node_view.h | 10 +- include/toml++/impl/preprocessor.h | 1 + meson.build | 1 - tests/meson.build | 1 + tests/visit.cpp | 139 ++++++++++++++++++ tests/vs/test_debug_x64.vcxproj | 1 + tests/vs/test_debug_x64_cpplatest.vcxproj | 1 + .../test_debug_x64_cpplatest_noexcept.vcxproj | 1 + ...debug_x64_cpplatest_noexcept_unrel.vcxproj | 1 + .../vs/test_debug_x64_cpplatest_unrel.vcxproj | 1 + tests/vs/test_debug_x64_noexcept.vcxproj | 1 + .../vs/test_debug_x64_noexcept_unrel.vcxproj | 1 + tests/vs/test_debug_x64_unrel.vcxproj | 1 + tests/vs/test_debug_x86.vcxproj | 1 + tests/vs/test_debug_x86_cpplatest.vcxproj | 1 + .../test_debug_x86_cpplatest_noexcept.vcxproj | 1 + ...debug_x86_cpplatest_noexcept_unrel.vcxproj | 1 + .../vs/test_debug_x86_cpplatest_unrel.vcxproj | 1 + tests/vs/test_debug_x86_noexcept.vcxproj | 1 + .../vs/test_debug_x86_noexcept_unrel.vcxproj | 1 + tests/vs/test_debug_x86_unrel.vcxproj | 1 + tests/vs/test_release_x64.vcxproj | 1 + tests/vs/test_release_x64_cpplatest.vcxproj | 1 + ...est_release_x64_cpplatest_noexcept.vcxproj | 1 + ...lease_x64_cpplatest_noexcept_unrel.vcxproj | 1 + .../test_release_x64_cpplatest_unrel.vcxproj | 1 + tests/vs/test_release_x64_noexcept.vcxproj | 1 + .../test_release_x64_noexcept_unrel.vcxproj | 1 + tests/vs/test_release_x64_unrel.vcxproj | 1 + tests/vs/test_release_x86.vcxproj | 1 + tests/vs/test_release_x86_cpplatest.vcxproj | 1 + ...est_release_x86_cpplatest_noexcept.vcxproj | 1 + ...lease_x86_cpplatest_noexcept_unrel.vcxproj | 1 + .../test_release_x86_cpplatest_unrel.vcxproj | 1 + tests/vs/test_release_x86_noexcept.vcxproj | 1 + .../test_release_x86_noexcept_unrel.vcxproj | 1 + tests/vs/test_release_x86_unrel.vcxproj | 1 + toml.hpp | 11 +- tools/generate_windows_test_targets.py | 1 + 44 files changed, 244 insertions(+), 15 deletions(-) create mode 100644 tests/visit.cpp diff --git a/CHANGELOG.md b/CHANGELOG.md index 7977a078..6a287e09 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,8 @@ template: - Meson: Use system dependencies where available when building tests (@Tachi107) +

+ ## [v3.0.1](https://github.com/marzer/tomlplusplus/releases/tag/v3.0.1) - 2022-01-13 @@ -47,6 +49,8 @@ this release holds nothing of value over v3.0.0. - fixed erroneous use of `TOML_API` causing ODR issue (#136) (@Azarael) +

+ ## [v3.0.0](https://github.com/marzer/tomlplusplus/releases/tag/v3.0.0) - 2022-01-11 @@ -137,6 +141,8 @@ Any changes that are likely to cause migration issues (API changes, build system - used `override_dependency` where supported (#116) (@Tachi107) +

+ ## [v2.5.0](https://github.com/marzer/tomlplusplus/releases/tag/v2.5.0) - 2021-07-11 @@ -158,6 +164,8 @@ Any changes that are likely to cause migration issues (API changes, build system - updated conformance tests +

+ ## [v2.4.0](https://github.com/marzer/tomlplusplus/releases/tag/v2.4.0) - 2021-05-19 @@ -186,6 +194,8 @@ Any changes that are likely to cause migration issues (API changes, build system - removed explicit `#include ` requirement for `parse_file()` +

+ ## [v2.3.0](https://github.com/marzer/tomlplusplus/releases/tag/v2.3.0) - 2020-12-29 @@ -202,6 +212,8 @@ Any changes that are likely to cause migration issues (API changes, build system - fixed some parser crashes when given pathologically-malformed UTF-8 (#65) (@sneves) +

+ ## [v2.2.0](https://github.com/marzer/tomlplusplus/releases/tag/v2.2.0) - 2020-08-09 @@ -230,6 +242,8 @@ Any changes that are likely to cause migration issues (API changes, build system - bumped minimum meson version to 0.53 +

+ ## [v2.1.0](https://github.com/marzer/tomlplusplus/releases/tag/v2.1.0) - 2020-07-11 @@ -257,6 +271,8 @@ Any changes that are likely to cause migration issues (API changes, build system - general cleanup +

+ ## [v2.0.0](https://github.com/marzer/tomlplusplus/releases/tag/v2.0.0) - 2020-07-20 @@ -300,6 +316,8 @@ break (hence the version number bump). Changes that might block a migration are - ⚠️ removed `TOML_CHAR_8_STRINGS` since it no longer makes sense +

+ ## [v1.3.3](https://github.com/marzer/tomlplusplus/releases/tag/v1.3.3) - 2020-06-29 @@ -320,6 +338,8 @@ break (hence the version number bump). Changes that might block a migration are - refactored the parser to reduce binary size +

+ ## [v1.3.2](https://github.com/marzer/tomlplusplus/releases/tag/v1.3.2) - 2020-06-19 @@ -334,6 +354,8 @@ break (hence the version number bump). Changes that might block a migration are - improved the performance of printing to streams for deepy-nested TOML data +

+ ## [v1.3.0](https://github.com/marzer/tomlplusplus/releases/tag/v1.3.0) - 2020-06-02 @@ -353,6 +375,8 @@ break (hence the version number bump). Changes that might block a migration are - renamed table iterator proxy pair members to `first` and `second` to match STL +

+ ## [v1.2.5](https://github.com/marzer/tomlplusplus/releases/tag/v1.2.5) - 2020-04-24 @@ -372,6 +396,8 @@ break (hence the version number bump). Changes that might block a migration are - improved unicode-related codegen +

+ ## [v1.2.3](https://github.com/marzer/tomlplusplus/releases/tag/v1.2.3) - 2020-04-11 @@ -393,6 +419,8 @@ break (hence the version number bump). Changes that might block a migration are - refactored and greatly simplified parser +

+ ## [v1.2.0](https://github.com/marzer/tomlplusplus/releases/tag/v1.2.0) - 2020-04-07 @@ -410,6 +438,8 @@ break (hence the version number bump). Changes that might block a migration are - added many new tests +

+ ## [v1.1.0](https://github.com/marzer/tomlplusplus/releases/tag/v1.1.0) - 2020-04-03 @@ -427,6 +457,8 @@ break (hence the version number bump). Changes that might block a migration are - added the array and table iterators to the `toml` namespace +

+ ## [v1.0.0](https://github.com/marzer/tomlplusplus/releases/tag/1.0.0) - 2020-03-28 @@ -437,6 +469,8 @@ break (hence the version number bump). Changes that might block a migration are - refactoring of ABI-based inline namespaces +

+ ## [v0.6.0](https://github.com/marzer/tomlplusplus/releases/tag/v0.6.0) - 2020-03-24 @@ -449,6 +483,8 @@ break (hence the version number bump). Changes that might block a migration are - added Clang's `[[trivial_abi]]` attribute to `date`, `time`, `time_offset` +

+ ## [v0.5.0](https://github.com/marzer/tomlplusplus/releases/tag/v0.5.0) - 2020-03-18 @@ -467,6 +503,8 @@ break (hence the version number bump). Changes that might block a migration are - added build configuration option for compiling examples +

+ ## [v0.4.3](https://github.com/marzer/tomlplusplus/releases/tag/v0.4.3) - 2020-03-10 @@ -480,6 +518,8 @@ break (hence the version number bump). Changes that might block a migration are - parsing performance improvements +

+ ## [v0.4.0](https://github.com/marzer/tomlplusplus/releases/tag/v0.4.0) - 2020-03-05 @@ -494,6 +534,8 @@ break (hence the version number bump). Changes that might block a migration are - added `node::ref()` and `node_view::ref()` +

+ ## [v0.3.0](https://github.com/marzer/tomlplusplus/releases/tag/v0.3.0) - 2020-03-01 @@ -512,6 +554,8 @@ break (hence the version number bump). Changes that might block a migration are - removed `` dependency +

+ ## [v0.2.1](https://github.com/marzer/tomlplusplus/releases/tag/v0.2.1) - 2020-02-26 @@ -526,6 +570,8 @@ break (hence the version number bump). Changes that might block a migration are - improved quality of error messages for boolean and inf/nan parsing +

+ ## [v0.2.0](https://github.com/marzer/tomlplusplus/releases/tag/v0.2.0) - 2020-02-23 @@ -543,6 +589,8 @@ break (hence the version number bump). Changes that might block a migration are - added hexfloat parsing support for all implementations (not just `` ones) +

+ ## [v0.1.0](https://github.com/marzer/tomlplusplus/releases/tag/v0.1.0) - 2020-02-20 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 306ccb40..d3d5b0aa 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -64,6 +64,9 @@ cd build-gcc-debug && ninja && ninja test \ && cd .. ``` +> ℹ️ Note: To ensure parity between single-header and regular versions of the library, 50% of the tests +will be compiled using one, and 50% with the other. Ensure you've regenerated toml.hpp before running tests. +
## Testing with the [toml-test] suite diff --git a/README.md b/README.md index 602279b1..0f892ae2 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ [![C++20](docs/images/badge-C++20.svg)][cpp_compilers] [![TOML](docs/images/badge-TOML.svg)][v1.0.0] [![MIT license](docs/images/badge-license-MIT.svg)](./LICENSE) -[![ci](https://github.com/marzer/tomlplusplus/actions/workflows/ci.yaml/badge.svg)](https://github.com/marzer/tomlplusplus/actions/workflows/ci.yaml) +[![ci](https://github.com/marzer/tomlplusplus/actions/workflows/ci.yaml/badge.svg?branch=master)](https://github.com/marzer/tomlplusplus/actions/workflows/ci.yaml) [![Mentioned in Awesome C++](docs/images/badge-awesome.svg)](https://github.com/fffaraz/awesome-cpp) ==== diff --git a/docs/poxy.toml b/docs/poxy.toml index fa75d832..e9eb4f7c 100644 --- a/docs/poxy.toml +++ b/docs/poxy.toml @@ -68,9 +68,9 @@ string_literals = [ '_toml' ] 'badge-TOML.svg', 'https://toml.io/en/v1.0.0' ] -'3. CircleCI' = [ - 'https://img.shields.io/circleci/build/github/marzer/tomlplusplus?label=circle%20ci&logo=circleci&logoColor=white&style=flat-square', - 'https://circleci.com/gh/marzer/tomlplusplus' +'3. CI' = [ + 'https://github.com/marzer/tomlplusplus/actions/workflows/ci.yaml/badge.svg?branch=master', + 'https://github.com/marzer/tomlplusplus/actions/workflows/ci.yaml' ] '4. Mentioned in Awesome C++' = [ 'badge-awesome.svg', diff --git a/include/toml++/impl/node.h b/include/toml++/impl/node.h index 0c99d42c..bd8f8e51 100644 --- a/include/toml++/impl/node.h +++ b/include/toml++/impl/node.h @@ -797,10 +797,6 @@ TOML_NAMESPACE_START template using nonvoid = std::conditional_t, B, A>; - //# these functions are static helpers to preserve const and ref categories - //# (otherwise I'd have to implement them thrice) - //# ((propagation in C++: a modern horror story)) - template static decltype(auto) do_visit(N&& n, Func&& visitor) noexcept(visit_is_nothrow) { diff --git a/include/toml++/impl/node_view.h b/include/toml++/impl/node_view.h index fe9c9430..7cb2f105 100644 --- a/include/toml++/impl/node_view.h +++ b/include/toml++/impl/node_view.h @@ -72,9 +72,6 @@ TOML_NAMESPACE_START mutable viewed_type* node_ = nullptr; - template - static constexpr bool visit_is_nothrow = noexcept(std::declval()->visit(std::declval())); - public: /// \brief Constructs an empty node view. TOML_NODISCARD_CTOR @@ -567,6 +564,13 @@ TOML_NAMESPACE_START /// \name Visitation /// @{ + private: + /// \cond + template + static constexpr bool visit_is_nothrow = noexcept(std::declval()->visit(std::declval())); + /// \endcond + + public: /// \brief Invokes a visitor on the viewed node based on its concrete type. /// /// \remarks Has no effect if the view does not reference a node. diff --git a/include/toml++/impl/preprocessor.h b/include/toml++/impl/preprocessor.h index 3bf741af..d761b5db 100644 --- a/include/toml++/impl/preprocessor.h +++ b/include/toml++/impl/preprocessor.h @@ -323,6 +323,7 @@ _Pragma("GCC diagnostic ignored \"-Wsubobject-linkage\"") \ _Pragma("GCC diagnostic ignored \"-Wmissing-field-initializers\"") \ _Pragma("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") \ + _Pragma("GCC diagnostic ignored \"-Wnoexcept\"") \ static_assert(true) #define TOML_POP_WARNINGS \ diff --git a/meson.build b/meson.build index 1c92db76..4c511a38 100644 --- a/meson.build +++ b/meson.build @@ -85,7 +85,6 @@ if is_gcc '-Wmissing-format-attribute', '-Wmissing-include-dirs', '-Wmissing-noreturn', - '-Wnoexcept', '-Wold-style-cast', '-Woverloaded-virtual', '-Wpacked', diff --git a/tests/meson.build b/tests/meson.build index 2ef4ddcc..ddc5a8af 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -21,6 +21,7 @@ test_sources = [ 'manipulating_arrays.cpp', 'manipulating_tables.cpp', 'manipulating_values.cpp', + 'visit.cpp', 'user_feedback.cpp', 'using_iterators.cpp', 'windows_compat.cpp' diff --git a/tests/visit.cpp b/tests/visit.cpp new file mode 100644 index 00000000..0509838d --- /dev/null +++ b/tests/visit.cpp @@ -0,0 +1,139 @@ +// This file is a part of toml++ and is subject to the the terms of the MIT license. +// Copyright (c) Mark Gillard +// See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text. +// SPDX-License-Identifier: MIT + +#include "tests.h" +TOML_DISABLE_SPAM_WARNINGS; + +TEST_CASE("node::visit") +{ + value val{ 3 }; + + // check lvalue propagates correctly + static_cast(val).visit( + [](auto&& v) noexcept + { + using val_ref_type = decltype(v); + static_assert(std::is_lvalue_reference_v); + + using val_type = std::remove_reference_t; + static_assert(!std::is_const_v); + static_assert(!std::is_volatile_v); + }); + + // check rvalue propagates correctly + static_cast(val).visit( + [](auto&& v) noexcept + { + using val_ref_type = decltype(v); + static_assert(std::is_rvalue_reference_v); + + using val_type = std::remove_reference_t; + static_assert(!std::is_const_v); + static_assert(!std::is_volatile_v); + }); + + // check const lvalue propagates correctly + static_cast(val).visit( + [](auto&& v) noexcept + { + using val_ref_type = decltype(v); + static_assert(std::is_lvalue_reference_v); + + using val_type = std::remove_reference_t; + static_assert(std::is_const_v); + static_assert(!std::is_volatile_v); + }); + + // check const rvalue propagates correctly + static_cast(val).visit( + [](auto&& v) noexcept + { + using val_ref_type = decltype(v); + static_assert(std::is_rvalue_reference_v); + + using val_type = std::remove_reference_t; + static_assert(std::is_const_v); + static_assert(!std::is_volatile_v); + }); + + // check noexcept + static constexpr auto throwing_visitor = [](auto&&) noexcept(false) {}; + static constexpr auto non_throwing_visitor = [](auto&&) noexcept(true) {}; + static_assert(!noexcept(static_cast(val).visit(throwing_visitor))); + static_assert(!noexcept(static_cast(val).visit(throwing_visitor))); + static_assert(!noexcept(static_cast(val).visit(throwing_visitor))); + static_assert(!noexcept(static_cast(val).visit(throwing_visitor))); + static_assert(noexcept(static_cast(val).visit(non_throwing_visitor))); + static_assert(noexcept(static_cast(val).visit(non_throwing_visitor))); + static_assert(noexcept(static_cast(val).visit(non_throwing_visitor))); + static_assert(noexcept(static_cast(val).visit(non_throwing_visitor))); + + // check return + static constexpr auto returns_boolean = [](auto& v) noexcept { return toml::is_integer; }; + auto return_test = static_cast(val).visit(returns_boolean); + static_assert(std::is_same_v); + CHECK(return_test == true); +} + +TEST_CASE("node_view::visit") +{ + value val{ 3 }; + + auto view = node_view{ val }; + auto cview = node_view{ std::as_const(val) }; + static_assert(!std::is_same_v); + + // check mutable views propagate correctly + view.visit( + [](auto&& v) noexcept + { + using val_ref_type = decltype(v); + static_assert(std::is_lvalue_reference_v); + + using val_type = std::remove_reference_t; + static_assert(!std::is_const_v); + static_assert(!std::is_volatile_v); + }); + + // check const views propagate correctly + cview.visit( + [](auto&& v) noexcept + { + using val_ref_type = decltype(v); + static_assert(std::is_lvalue_reference_v); + + using val_type = std::remove_reference_t; + static_assert(std::is_const_v); + static_assert(!std::is_volatile_v); + }); + + // check noexcept + static constexpr auto throwing_visitor = [](auto&&) noexcept(false) {}; + static constexpr auto non_throwing_visitor = [](auto&&) noexcept(true) {}; + static_assert(!noexcept(view.visit(throwing_visitor))); + static_assert(!noexcept(cview.visit(throwing_visitor))); + static_assert(noexcept(view.visit(non_throwing_visitor))); + static_assert(noexcept(cview.visit(non_throwing_visitor))); + + // check return + static constexpr auto returns_boolean = [](auto&& v) noexcept { return toml::is_integer; }; + auto return_test = view.visit(returns_boolean); + static_assert(std::is_same_v); + CHECK(return_test == true); + + // check that null views don't invoke the visitor + // clang-format off + auto null_view = decltype(view){}; + auto null_cview = decltype(cview){}; + unsigned count{}; + unsigned mask{}; + view.visit([&](auto&&) noexcept { count++; mask |= 0b0001u; }); + cview.visit([&](auto&&) noexcept { count++; mask |= 0b0010u; }); + null_view.visit([&](auto&&) noexcept { count++; mask |= 0b0100u; }); + null_cview.visit([&](auto&&) noexcept { count++; mask |= 0b1000u; }); + CHECK(count == 2u); + CHECK(mask == 0b0011u); + // clang-format on +} diff --git a/tests/vs/test_debug_x64.vcxproj b/tests/vs/test_debug_x64.vcxproj index cbcbe218..2b96d60a 100644 --- a/tests/vs/test_debug_x64.vcxproj +++ b/tests/vs/test_debug_x64.vcxproj @@ -104,6 +104,7 @@ + diff --git a/tests/vs/test_debug_x64_cpplatest.vcxproj b/tests/vs/test_debug_x64_cpplatest.vcxproj index a88e5f4e..9f6dc836 100644 --- a/tests/vs/test_debug_x64_cpplatest.vcxproj +++ b/tests/vs/test_debug_x64_cpplatest.vcxproj @@ -104,6 +104,7 @@ + diff --git a/tests/vs/test_debug_x64_cpplatest_noexcept.vcxproj b/tests/vs/test_debug_x64_cpplatest_noexcept.vcxproj index 9444ead1..be7ad645 100644 --- a/tests/vs/test_debug_x64_cpplatest_noexcept.vcxproj +++ b/tests/vs/test_debug_x64_cpplatest_noexcept.vcxproj @@ -104,6 +104,7 @@ + diff --git a/tests/vs/test_debug_x64_cpplatest_noexcept_unrel.vcxproj b/tests/vs/test_debug_x64_cpplatest_noexcept_unrel.vcxproj index 9d2be789..1d946748 100644 --- a/tests/vs/test_debug_x64_cpplatest_noexcept_unrel.vcxproj +++ b/tests/vs/test_debug_x64_cpplatest_noexcept_unrel.vcxproj @@ -104,6 +104,7 @@ + diff --git a/tests/vs/test_debug_x64_cpplatest_unrel.vcxproj b/tests/vs/test_debug_x64_cpplatest_unrel.vcxproj index 98934dc0..aa8f930f 100644 --- a/tests/vs/test_debug_x64_cpplatest_unrel.vcxproj +++ b/tests/vs/test_debug_x64_cpplatest_unrel.vcxproj @@ -104,6 +104,7 @@ + diff --git a/tests/vs/test_debug_x64_noexcept.vcxproj b/tests/vs/test_debug_x64_noexcept.vcxproj index 87b3024d..e4e9dd87 100644 --- a/tests/vs/test_debug_x64_noexcept.vcxproj +++ b/tests/vs/test_debug_x64_noexcept.vcxproj @@ -104,6 +104,7 @@ + diff --git a/tests/vs/test_debug_x64_noexcept_unrel.vcxproj b/tests/vs/test_debug_x64_noexcept_unrel.vcxproj index 7df2dd2b..a7399f6b 100644 --- a/tests/vs/test_debug_x64_noexcept_unrel.vcxproj +++ b/tests/vs/test_debug_x64_noexcept_unrel.vcxproj @@ -104,6 +104,7 @@ + diff --git a/tests/vs/test_debug_x64_unrel.vcxproj b/tests/vs/test_debug_x64_unrel.vcxproj index 7a02c5f3..20b3f8be 100644 --- a/tests/vs/test_debug_x64_unrel.vcxproj +++ b/tests/vs/test_debug_x64_unrel.vcxproj @@ -104,6 +104,7 @@ + diff --git a/tests/vs/test_debug_x86.vcxproj b/tests/vs/test_debug_x86.vcxproj index 6174752d..634ec22e 100644 --- a/tests/vs/test_debug_x86.vcxproj +++ b/tests/vs/test_debug_x86.vcxproj @@ -104,6 +104,7 @@ + diff --git a/tests/vs/test_debug_x86_cpplatest.vcxproj b/tests/vs/test_debug_x86_cpplatest.vcxproj index c7688206..77011478 100644 --- a/tests/vs/test_debug_x86_cpplatest.vcxproj +++ b/tests/vs/test_debug_x86_cpplatest.vcxproj @@ -104,6 +104,7 @@ + diff --git a/tests/vs/test_debug_x86_cpplatest_noexcept.vcxproj b/tests/vs/test_debug_x86_cpplatest_noexcept.vcxproj index 3260b04f..ae4ec0ae 100644 --- a/tests/vs/test_debug_x86_cpplatest_noexcept.vcxproj +++ b/tests/vs/test_debug_x86_cpplatest_noexcept.vcxproj @@ -104,6 +104,7 @@ + diff --git a/tests/vs/test_debug_x86_cpplatest_noexcept_unrel.vcxproj b/tests/vs/test_debug_x86_cpplatest_noexcept_unrel.vcxproj index 4a519650..d16089c7 100644 --- a/tests/vs/test_debug_x86_cpplatest_noexcept_unrel.vcxproj +++ b/tests/vs/test_debug_x86_cpplatest_noexcept_unrel.vcxproj @@ -104,6 +104,7 @@ + diff --git a/tests/vs/test_debug_x86_cpplatest_unrel.vcxproj b/tests/vs/test_debug_x86_cpplatest_unrel.vcxproj index b3e1dc81..34fc310c 100644 --- a/tests/vs/test_debug_x86_cpplatest_unrel.vcxproj +++ b/tests/vs/test_debug_x86_cpplatest_unrel.vcxproj @@ -104,6 +104,7 @@ + diff --git a/tests/vs/test_debug_x86_noexcept.vcxproj b/tests/vs/test_debug_x86_noexcept.vcxproj index 7d0beb22..192ae510 100644 --- a/tests/vs/test_debug_x86_noexcept.vcxproj +++ b/tests/vs/test_debug_x86_noexcept.vcxproj @@ -104,6 +104,7 @@ + diff --git a/tests/vs/test_debug_x86_noexcept_unrel.vcxproj b/tests/vs/test_debug_x86_noexcept_unrel.vcxproj index 7a325b9e..57598fe7 100644 --- a/tests/vs/test_debug_x86_noexcept_unrel.vcxproj +++ b/tests/vs/test_debug_x86_noexcept_unrel.vcxproj @@ -104,6 +104,7 @@ + diff --git a/tests/vs/test_debug_x86_unrel.vcxproj b/tests/vs/test_debug_x86_unrel.vcxproj index ae743abd..a808b560 100644 --- a/tests/vs/test_debug_x86_unrel.vcxproj +++ b/tests/vs/test_debug_x86_unrel.vcxproj @@ -104,6 +104,7 @@ + diff --git a/tests/vs/test_release_x64.vcxproj b/tests/vs/test_release_x64.vcxproj index 509d6146..ee66af0a 100644 --- a/tests/vs/test_release_x64.vcxproj +++ b/tests/vs/test_release_x64.vcxproj @@ -104,6 +104,7 @@ + diff --git a/tests/vs/test_release_x64_cpplatest.vcxproj b/tests/vs/test_release_x64_cpplatest.vcxproj index c594bbe9..b0a4971b 100644 --- a/tests/vs/test_release_x64_cpplatest.vcxproj +++ b/tests/vs/test_release_x64_cpplatest.vcxproj @@ -104,6 +104,7 @@ + diff --git a/tests/vs/test_release_x64_cpplatest_noexcept.vcxproj b/tests/vs/test_release_x64_cpplatest_noexcept.vcxproj index ebd080a1..327e53ec 100644 --- a/tests/vs/test_release_x64_cpplatest_noexcept.vcxproj +++ b/tests/vs/test_release_x64_cpplatest_noexcept.vcxproj @@ -104,6 +104,7 @@ + diff --git a/tests/vs/test_release_x64_cpplatest_noexcept_unrel.vcxproj b/tests/vs/test_release_x64_cpplatest_noexcept_unrel.vcxproj index ed9fcb35..44ca1db0 100644 --- a/tests/vs/test_release_x64_cpplatest_noexcept_unrel.vcxproj +++ b/tests/vs/test_release_x64_cpplatest_noexcept_unrel.vcxproj @@ -104,6 +104,7 @@ + diff --git a/tests/vs/test_release_x64_cpplatest_unrel.vcxproj b/tests/vs/test_release_x64_cpplatest_unrel.vcxproj index 18a6a440..80e65754 100644 --- a/tests/vs/test_release_x64_cpplatest_unrel.vcxproj +++ b/tests/vs/test_release_x64_cpplatest_unrel.vcxproj @@ -104,6 +104,7 @@ + diff --git a/tests/vs/test_release_x64_noexcept.vcxproj b/tests/vs/test_release_x64_noexcept.vcxproj index 12f8dfd5..1a1d4c19 100644 --- a/tests/vs/test_release_x64_noexcept.vcxproj +++ b/tests/vs/test_release_x64_noexcept.vcxproj @@ -104,6 +104,7 @@ + diff --git a/tests/vs/test_release_x64_noexcept_unrel.vcxproj b/tests/vs/test_release_x64_noexcept_unrel.vcxproj index e50ffa8a..b9f5c917 100644 --- a/tests/vs/test_release_x64_noexcept_unrel.vcxproj +++ b/tests/vs/test_release_x64_noexcept_unrel.vcxproj @@ -104,6 +104,7 @@ + diff --git a/tests/vs/test_release_x64_unrel.vcxproj b/tests/vs/test_release_x64_unrel.vcxproj index 51bfd767..64507f37 100644 --- a/tests/vs/test_release_x64_unrel.vcxproj +++ b/tests/vs/test_release_x64_unrel.vcxproj @@ -104,6 +104,7 @@ + diff --git a/tests/vs/test_release_x86.vcxproj b/tests/vs/test_release_x86.vcxproj index bb22f38f..20da1db4 100644 --- a/tests/vs/test_release_x86.vcxproj +++ b/tests/vs/test_release_x86.vcxproj @@ -104,6 +104,7 @@ + diff --git a/tests/vs/test_release_x86_cpplatest.vcxproj b/tests/vs/test_release_x86_cpplatest.vcxproj index 3fb3d252..765d41b1 100644 --- a/tests/vs/test_release_x86_cpplatest.vcxproj +++ b/tests/vs/test_release_x86_cpplatest.vcxproj @@ -104,6 +104,7 @@ + diff --git a/tests/vs/test_release_x86_cpplatest_noexcept.vcxproj b/tests/vs/test_release_x86_cpplatest_noexcept.vcxproj index a9e38c47..d3b27ea3 100644 --- a/tests/vs/test_release_x86_cpplatest_noexcept.vcxproj +++ b/tests/vs/test_release_x86_cpplatest_noexcept.vcxproj @@ -104,6 +104,7 @@ + diff --git a/tests/vs/test_release_x86_cpplatest_noexcept_unrel.vcxproj b/tests/vs/test_release_x86_cpplatest_noexcept_unrel.vcxproj index 5ce9ffce..55d7d348 100644 --- a/tests/vs/test_release_x86_cpplatest_noexcept_unrel.vcxproj +++ b/tests/vs/test_release_x86_cpplatest_noexcept_unrel.vcxproj @@ -104,6 +104,7 @@ + diff --git a/tests/vs/test_release_x86_cpplatest_unrel.vcxproj b/tests/vs/test_release_x86_cpplatest_unrel.vcxproj index 546f3a4b..4399f974 100644 --- a/tests/vs/test_release_x86_cpplatest_unrel.vcxproj +++ b/tests/vs/test_release_x86_cpplatest_unrel.vcxproj @@ -104,6 +104,7 @@ + diff --git a/tests/vs/test_release_x86_noexcept.vcxproj b/tests/vs/test_release_x86_noexcept.vcxproj index ccc7a312..4c9661d0 100644 --- a/tests/vs/test_release_x86_noexcept.vcxproj +++ b/tests/vs/test_release_x86_noexcept.vcxproj @@ -104,6 +104,7 @@ + diff --git a/tests/vs/test_release_x86_noexcept_unrel.vcxproj b/tests/vs/test_release_x86_noexcept_unrel.vcxproj index adf01a3e..ac49efee 100644 --- a/tests/vs/test_release_x86_noexcept_unrel.vcxproj +++ b/tests/vs/test_release_x86_noexcept_unrel.vcxproj @@ -104,6 +104,7 @@ + diff --git a/tests/vs/test_release_x86_unrel.vcxproj b/tests/vs/test_release_x86_unrel.vcxproj index d91d19fe..7b074520 100644 --- a/tests/vs/test_release_x86_unrel.vcxproj +++ b/tests/vs/test_release_x86_unrel.vcxproj @@ -104,6 +104,7 @@ + diff --git a/toml.hpp b/toml.hpp index abb868b7..409a1cae 100644 --- a/toml.hpp +++ b/toml.hpp @@ -347,6 +347,7 @@ _Pragma("GCC diagnostic ignored \"-Wsubobject-linkage\"") \ _Pragma("GCC diagnostic ignored \"-Wmissing-field-initializers\"") \ _Pragma("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") \ + _Pragma("GCC diagnostic ignored \"-Wnoexcept\"") \ static_assert(true) #define TOML_POP_WARNINGS \ @@ -3253,9 +3254,6 @@ TOML_NAMESPACE_START mutable viewed_type* node_ = nullptr; - template - static constexpr bool visit_is_nothrow = noexcept(std::declval()->visit(std::declval())); - public: TOML_NODISCARD_CTOR @@ -3529,6 +3527,13 @@ TOML_NAMESPACE_START return node_->template ref(); } + private: + + template + static constexpr bool visit_is_nothrow = noexcept(std::declval()->visit(std::declval())); + + public: + template decltype(auto) visit(Func&& visitor) const noexcept(visit_is_nothrow) { diff --git a/tools/generate_windows_test_targets.py b/tools/generate_windows_test_targets.py index 727d9dd0..ff7fed34 100755 --- a/tools/generate_windows_test_targets.py +++ b/tools/generate_windows_test_targets.py @@ -147,6 +147,7 @@ def main(): +