erikdoe / ocmock

Mock objects for Objective-C
http://ocmock.org
Apache License 2.0
2.16k stars 606 forks source link

Failure of -isMethodReturnType:compatibleWithValueType: for some methods taking structs with iOS 11 SDK #342

Closed sdefresne closed 7 years ago

sdefresne commented 7 years ago

Chrome on iOS is building with iOS 11 SDK and experiencing errors when trying to mock returning/passing some structure by reference (see http://crbug.com/736987).

The issue happens because the code tries to compare the following two strings:

r^{GURL={basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >={__compressed_pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__rep, std::__1::allocator<char> >={__rep}}}B{Parsed={Component=ii}{Component=ii}{Component=ii}{Component=ii}{Component=ii}{Component=ii}{Component=ii}{Component=ii}B^{}}{unique_ptr<GURL, std::__1::default_delete<GURL> >={__compressed_pair<GURL *, std::__1::default_delete<GURL> >=^{}}}}

and

r^{GURL={basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >={__compressed_pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__rep, std::__1::allocator<char> >={__rep=(?={__long=QQ*}{__short=(?=Cc)[23c]}{__raw=[3Q]})}}}B{Parsed={Component=ii}{Component=ii}{Component=ii}{Component=ii}{Component=ii}{Component=ii}{Component=ii}{Component=ii}B^{Parsed}}{unique_ptr<GURL, std::__1::default_delete<GURL> >={__compressed_pair<GURL *, std::__1::default_delete<GURL> >=^{GURL}}}}

Some things that the code does not like are {} and {__rep}.

sdefresne commented 7 years ago

Forgot to mention that this happens with HEAD version of ocmock fetched from github.

erikdoe commented 7 years ago

Yeah, I had noticed that, too. And I'm glad that you've provided a fix. It would have taken me a while to get into this. Thanks.

erikdoe commented 7 years ago

Thanks! Have merged the PR now.