From 1c6a319e4204e325fabb69f21abc5a826362dc5d Mon Sep 17 00:00:00 2001 From: "Dr. Colin Hirsch" Date: Fri, 22 Sep 2023 20:47:00 +0200 Subject: [PATCH] Fix bogus warning. --- include/tao/pegtl/internal/has_current_position.hpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/tao/pegtl/internal/has_current_position.hpp b/include/tao/pegtl/internal/has_current_position.hpp index 3558ceb14..d1ef5e44c 100644 --- a/include/tao/pegtl/internal/has_current_position.hpp +++ b/include/tao/pegtl/internal/has_current_position.hpp @@ -15,7 +15,9 @@ namespace TAO_PEGTL_NAMESPACE::internal inline constexpr bool has_current_position = false; template< typename C > - inline constexpr bool has_current_position< C, decltype( std::declval< C >().current_position(), void() ) > = true; + inline constexpr bool has_current_position< C, decltype( (void)std::declval< C >().current_position(), void() ) > = true; + + // The (void) is to shut up a warning from GCC 9 and 10 about the return value of the nodiscard-function current_position() being ignored. } // namespace TAO_PEGTL_NAMESPACE::internal