Skip to content

Commit

Permalink
🚨 Suppress warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
yosh-matsuda committed Feb 10, 2024
1 parent 733167d commit 3602b7b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 deletions.
7 changes: 7 additions & 0 deletions include/cpp_yyjson.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3827,6 +3827,10 @@ namespace yyjson
template <typename... Ts>
struct caster<std::variant<Ts...>>
{
#if defined(__GNUC__) or defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-value"
#endif
template <typename Json>
static std::variant<Ts...> from_json(const Json& json)
{
Expand All @@ -3835,6 +3839,9 @@ namespace yyjson
if (result.has_value()) return *result;
throw bad_cast(fmt::format("{} is not constructible from JSON", NAMEOF_TYPE(std::variant<Ts...>)));
}
#if defined(__GNUC__) or defined(__clang__)
#pragma GCC diagnostic pop
#endif

template <detail::copy_string_args... Args>
requires requires(writer::value_ref& val) { ((val = std::declval<Ts>()), ...); }
Expand Down
23 changes: 14 additions & 9 deletions include/field_reflection.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*===================================================*
| field-reflection version v0.2.0 |
| field-reflection version v0.2.1 |
| https://github.com/yosh-matsuda/field-reflection |
| |
| Copyright (c) 2024 Yoshiki Matsuda @yosh-matsuda |
Expand All @@ -22,6 +22,11 @@ namespace field_reflection
{
namespace detail
{

#if defined(__GNUC__) || defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wundefined-inline"
#endif
template <typename T, std::size_t = 0>
struct any_lref
{
Expand Down Expand Up @@ -78,6 +83,9 @@ namespace field_reflection
requires std::is_base_of_v<U, T>
constexpr operator U() const&& noexcept; // NOLINT
};
#if defined(__GNUC__) || defined(__clang__)
#pragma GCC diagnostic pop
#endif

template <typename T, std::size_t ArgNum>
concept constructible = []() {
Expand Down Expand Up @@ -123,16 +131,13 @@ namespace field_reflection
{
return std::numeric_limits<std::size_t>::max();
}
else if constexpr (constructible<T, N> && !constructible<T, N + 1>)
{
return N;
}
else
{
if constexpr (constructible<T, N> && !constructible<T, N + 1>)
{
return N;
}
else
{
return field_count_impl<T, N + 1>;
}
return field_count_impl<T, N + 1>;
}
}();

Expand Down

0 comments on commit 3602b7b

Please sign in to comment.