-
-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Description
- What is the issue you have?
Compilation error - Please describe the steps to reproduce the issue. Can you provide a small but working code example?
code :
#include "stdafx.h"
#include <gmock/gmock.h>
#include <nlohmann/json.hpp>
using Json = nlohmann::json;
//using Json = std::wstring;
namespace tests {
/**/
class GMockTest {
public:
GMockTest() = default;
virtual ~GMockTest() = default;
virtual void read(const Json& data){
};
};
class GMockTestMock final : public GMockTest {
public:
~GMockTestMock() override{};
MOCK_METHOD1(read, void(const Json&));
};
using ::testing::_;
using ::testing::AnyNumber;
using ::testing::Invoke;
TEST(RequestClient, read_test)
{
auto io = std::make_shared<GMockTestMock>();
EXPECT_CALL(*io, read(_)).WillRepeatedly(Invoke([&](const Json& data) {
}));
}
}
- What is the expected behavior?
code compiled - And what is the actual behavior instead?
compilation errors:
1> \x86-windows-static\include\gmock\gmock-actions.h(388): error C2666: 'testing::internal::linked_ptr<testing::ActionInterface>::operator ==': 3 overloads have similar conversions
1> with
1> [
1> F=void (const nlohmann::basic_jsonstd::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer &)
1> ]
1> \x86-windows-static\include\gtest\internal\gtest-linked_ptr.h(186): note: could be 'bool testing::internal::linked_ptr<testing::ActionInterface>::operator ==(T *) const'
1> with
1> [
1> F=void (const nlohmann::basic_jsonstd::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer &),
1> T=testing::ActionInterface<void (const nlohmann::basic_jsonstd::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer &)>
1> ]
1>c:\program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.15.26726\include\exception(321): note: or 'bool std::operator ==(const std::exception_ptr &,const std::exception_ptr &) noexcept' [found using argument-dependent lookup]
1>c:\program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.15.26726\include\exception(326): note: or 'bool std::operator ==(std::nullptr_t,const std::exception_ptr &) noexcept' [found using argument-dependent lookup]
1>c:\program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.15.26726\include\exception(331): note: or 'bool std::operator ==(const std::exception_ptr &,std::nullptr_t) noexcept' [found using argument-dependent lookup]
1>c:\program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.15.26726\include\system_error(266): note: or 'bool std::operator ==(const std::error_code &,const std::error_code &) noexcept' [found using argument-dependent lookup]
1>c:\program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.15.26726\include\system_error(272): note: or 'bool std::operator ==(const std::error_code &,const std::error_condition &) noexcept' [found using argument-dependent lookup]
1>c:\program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.15.26726\include\system_error(278): note: or 'bool std::operator ==(const std::error_condition &,const std::error_code &) noexcept' [found using argument-dependent lookup]
1>c:\program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.15.26726\include\system_error(284): note: or 'bool std::operator ==(const std::error_condition &,const std::error_condition &) noexcept' [found using argument-dependent lookup]
1> \x86-windows-static\include\nlohmann\json.hpp(16582): note: or 'bool nlohmann::basic_jsonstd::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer::operator ==(const nlohmann::basic_jsonstd::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer &,const nlohmann::basic_jsonstd::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer &) noexcept' [found using argument-dependent lookup]
1> \x86-windows-static\include\nlohmann\json.hpp(11112): note: or 'bool nlohmann::json_pointer<nlohmann::basic_jsonstd::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer>::operator ==(const nlohmann::json_pointer<nlohmann::basic_jsonstd::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer> &,const nlohmann::json_pointer<nlohmann::basic_jsonstd::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer> &) noexcept' [found using argument-dependent lookup]
1> \x86-windows-static\include\nlohmann\json.hpp(16653): note: or 'bool nlohmann::operator ==<nullptr,0>(const nlohmann::basic_jsonstd::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer &,const ScalarType) noexcept'
1> with
1> [
1> ScalarType=nullptr
1> ]
1> \x86-windows-static\include\gmock\gmock-actions.h(388): note: while trying to match the argument list '(const testing::internal::linked_ptr<testing::ActionInterface>, nullptr)'
1> with
1> [
1> F=void (const nlohmann::basic_jsonstd::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer &)
1> ]
1> \x86-windows-static\include\gmock\gmock-actions.h(386): note: while compiling class template member function 'bool testing::Action::IsDoDefault(void) const'
1> with
1> [
1> F=void (const nlohmann::basic_jsonstd::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer &)
1> ]
1> \x86-windows-static\include\gmock\gmock-spec-builders.h(1712): note: see reference to function template instantiation 'bool testing::Action::IsDoDefault(void) const' being compiled
1> with
1> [
1> F=void (const nlohmann::basic_jsonstd::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer &)
1> ]
1> \x86-windows-static\include\gmock\gmock-spec-builders.h(1232): note: see reference to class template instantiation 'testing::Action' being compiled
1> with
1> [
1> F=void (const nlohmann::basic_jsonstd::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer &)
1> ]
1> \tests\test_jsonrpczmq.cpp(31): note: see reference to class template instantiation 'testing::internal::TypedExpectation' being compiled
1> with
1> [
1> F=void (const nlohmann::basic_jsonstd::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer &)
1> ]
- Which compiler and operating system are you using? Is it a supported compiler?
vs 15.8.1
gtest_1.8.0-9 ( build via vcpkg ) - Did you use a released version of the library or the version from the
developbranch?
build via vcpkg Version: 3.2.0 - If you experience a compilation error: can you compile and run the unit tests?
compiled; passed
NOTE: I'm not sure if it is problem to solve on GTest or Json side, but is working with other types.
NOTE: related? Build of unit tests fails in clang with c++11 google/googletest#1565
NOTE: im offline in next week,