Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions include/proxy/v4/detail/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -823,6 +823,13 @@ operand_t<P, IsDirect, Q> get_operand(proxy_accessor<F, IsDirect, Q> p) {
return *std::forward<add_qualifier_t<P, Q>>(ptr);
}
}

// When a dispatch always throws, MSVC may incorrectly warn about unreachable
// code (C4702). Disable the warning for invoke_dispatch().
#if defined(_MSC_VER) && !defined(__clang__)
#pragma warning(push)
#pragma warning(disable : 4702)
#endif // defined(_MSC_VER) && !defined(__clang__)
template <class D, class R, class... Args>
R invoke_dispatch(Args&&... args) {
if constexpr (std::is_void_v<R>) {
Expand All @@ -831,6 +838,9 @@ R invoke_dispatch(Args&&... args) {
return D()(std::forward<Args>(args)...);
}
}
#if defined(_MSC_VER) && !defined(__clang__)
#pragma warning(pop)
#endif // defined(_MSC_VER) && !defined(__clang__)
template <class P, class F, bool IsDirect, qualifier_type Q, class D, class R,
class... Args>
R reinterpret_invoke(proxy_accessor<F, IsDirect, Q> self, Args&&... args) {
Expand Down
10 changes: 2 additions & 8 deletions tests/proxy_invocation_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,9 @@
#include <typeindex>
#include <typeinfo>
#include <vector>
#if defined(_MSC_VER) && !defined(__clang__)
#pragma warning(push)
#pragma warning( \
disable : 4702) // False alarm from MSVC: warning C4702: unreachable code
#endif // defined(_MSC_VER) && !defined(__clang__)

#include <proxy/proxy.h>
#if defined(_MSC_VER) && !defined(__clang__)
#pragma warning(pop)
#endif // defined(_MSC_VER) && !defined(__clang__)

#include "utils.h"

namespace proxy_invocation_tests_detail {
Expand Down
8 changes: 0 additions & 8 deletions tests/proxy_regression_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,7 @@
// Licensed under the MIT License.

#include <gtest/gtest.h>
#if defined(_MSC_VER) && !defined(__clang__)
#pragma warning(push)
#pragma warning( \
disable : 4702) // False alarm from MSVC: warning C4702: unreachable code
#endif // defined(_MSC_VER) && !defined(__clang__)
#include <proxy/proxy.h>
#if defined(_MSC_VER) && !defined(__clang__)
#pragma warning(pop)
#endif // defined(_MSC_VER) && !defined(__clang__)
#include <vector>

namespace proxy_regression_tests_detail {
Expand Down
Loading