Closed malcolmdavey closed 1 year ago
Seems it works on VS, and clang, but not GCC
My code now compiles, but looks like it doesn't work with the Verify macro.
I tried both
Verify(RefOverloadedMethod(mock, Index, unsigned&()))
and
Verify(ConstRefOverloadedMethod(mock, Index, unsigned()))
but they both failed with expression failed, even though my unit test clearly calls them
My code now compiles, but looks like it doesn't work with the Verify macro. I tried both
Verify(RefOverloadedMethod(mock, Index, unsigned&()))
andVerify(ConstRefOverloadedMethod(mock, Index, unsigned()))
but they both failed with expression failed, even though my unit test clearly calls them
Sorry, didn't try the Verify, so I don't know what the issue is there. Verify has some other issues but am assuming aren't related
I got it working with GCC, basically we just need to replace the "double typedef" system in Prototype.hpp
to a "one typedef" system. I've also made some minor changes, like replacing the typedefs by aliases, because it's more modern and more readable.
I've tried to use the "suggest changes" feature of GitHub but it doesn't work (too many lines I guess). Here's the new Prototype
class:
template<typename R, typename... Args>
struct Prototype<R(Args...)> {
template<class C>
struct MemberType {
using Type = R (C::*)(Args...);
using ConstType = R (C::*)(Args...) const;
using RefType = R (C::*)(Args...) &;
using ConstRefType = R (C::*)(Args...) const&;
using RRefType = R (C::*)(Args...) &&;
using ConstRRefType = R (C::*)(Args...) const&&;
static Type get(Type t) {
return t;
}
static ConstType getconst(ConstType t) {
return t;
}
static RefType getRef(RefType t) {
return t;
}
static ConstRefType getConstRef(ConstRefType t) {
return t;
}
static RRefType getRRef(RRefType t) {
return t;
}
static ConstRRefType getConstRRef(ConstRRefType t) {
return t;
}
};
};
Haven't yet looked the Verify
issue.
I have no issue with the Verify
method, with either GCC or clang, with or without my changes to make GCC compatible.
Could you provide a code sample that fails @Ramjii ?
Sorry, I deleted the branch dev-2.3.1
after merging it to master, I didn't know it will close the PR. I cannot rebase it to dev-2.4.0
nor re-open it.
Partial fix for https://github.com/eranpeer/FakeIt/issues/292