Hi -- I'm trying to stub the value of a const string & method, but it fails to compile with the following error:
In file included from gmock/include/gmock/gmock.h:58:0,
from test/include/mocks/mocks.h:3,
from test/persistence/creator_test.cpp:1:
gmock/include/gmock/gmock-actions.h: In instantiation of 'testing::internal::ReturnAction<R>::operator testing::Action<Func>() const [with F = const std::basic_string<char>&(); R = std::basic_string<char>]':
test/persistence/creator_test.cpp:158:80: required from here
gmock/include/gmock/gmock-actions.h:469:5: error: size of array is negative
gmock/include/gmock/gmock-actions.h: In instantiation of 'class testing::internal::ReturnAction<std::basic_string<char> >::Impl<const std::basic_string<char>&()>':
gmock/include/gmock/gmock-actions.h:472:41: required from 'testing::internal::ReturnAction<R>::operator testing::Action<Func>() const [with F = const std::basic_string<char>&(); R = std::basic_string<char>]'
test/persistence/creator_test.cpp:158:80: required from here
gmock/include/gmock/gmock-actions.h:496:5: error: size of array is negative
rake aborted!
Command failed with status (1): [g++-mp-4.7 -c -Igmock/include -Igmock/gtes...]
I've cobbled together a file containing the code that's generating it as best I can -- the offending bit seems to be the call to WillByDefault() on line 74 (in my cobbled-together example file) -- if I comment that bit out (keeping the ON_CALL bit), it compiles just fine.
If anyone could help me, here, I'd be very grateful -- I'm obviously missing something pretty fundamental, but I've no idea what it is & have been chasing myself in futile circles with it for ages.
Doug.