Issue 11 in mockitopp: current trunk fails to compile with existing suite

6 views
Skip to first unread message

mock...@googlecode.com

unread,
Jan 8, 2013, 6:32:55 PM1/8/13
to mockit...@googlegroups.com
Status: Accepted
Owner: plaztiks...@gmail.com
Labels: Type-Defect Priority-Medium

New issue 11 by plaztiks...@gmail.com: current trunk fails to compile with
existing suite
http://code.google.com/p/mockitopp/issues/detail?id=11

What steps will reproduce the problem?
1. compile an existing suite (not sure why mockito's suite doesn't fail to
compile...)



What is the expected output? What do you see instead?

/work/mhargett/sport-trunk/protocol/lib/mockitopp/include/mockitopp/detail/stubbing/dynamic_vfunction.hpp:
In
function \u2018void
HttpCfeBlade_does_not_create_appblade_when_request_parsing_not_done()\u2019:
/work/mhargett/sport-trunk/protocol/lib/mockitopp/include/mockitopp/detail/stubbing/dynamic_vfunction.hpp:65:15:
error:
\u2018bool mockitopp::detail::dynamic_vfunction_base::never()
const\u2019 is inaccessible
protocol/http/appblade/http_cfe_blade_test.cc:71:5: error: within this
context
protocol/http/appblade/http_cfe_blade_test.cc:71:5: error:
\u2018mockitopp::detail::dynamic_vfunction_base\u2019 is not an accessible
base of \u2018mockitopp::detail::dynamic_vfunction<http::AppBlade*
(http::CfeAppBladeManager::*)(const Request&)>\u2019
In file included from
/work/mhargett/sport-trunk/protocol/lib/mockitopp/include/mockitopp/detail/stubbing/dynamic_object.hpp:5:0,
from
/work/mhargett/sport-trunk/protocol/lib/mockitopp/include/mockitopp/mock_object.hpp:4,
from protocol/http/appblade/http_cfe_blade_test.cc:4:
/work/mhargett/sport-trunk/protocol/lib/mockitopp/include/mockitopp/detail/stubbing/dynamic_vfunction.hpp:
In
function \u2018void
HttpCfeBlade_gives_parsed_request_to_appblade_returned_by_manager()\u2019:
/work/mhargett/sport-trunk/protocol/lib/mockitopp/include/mockitopp/detail/stubbing/dynamic_vfunction.hpp:59:15:
error:
\u2018bool mockitopp::detail::dynamic_vfunction_base::exactly(int)
const\u2019 is inaccessible
protocol/http/appblade/http_cfe_blade_test.cc:90:5: error: within this
context
protocol/http/appblade/http_cfe_blade_test.cc:90:5: error:
\u2018mockitopp::detail::dynamic_vfunction_base\u2019 is not an accessible
base of \u2018mockitopp::detail::dynamic_vfunction<http::AppBlade*
(http::CfeAppBladeManager::*)(const Request&)>\u2019



If I change the dynamic_vfunction<> templates to *publicly* inherit from
dynamic_vfunction_progress<R> in
include/mockitopp/detail/stubbing/dynamic_vfunction.hpp, the compile
problem is fixed.

This is with g++ 4.7 in gnu++11 mode on a RHEL6.2 variant.


mock...@googlecode.com

unread,
Jan 8, 2013, 11:29:02 PM1/8/13
to mockit...@googlegroups.com

Comment #1 on issue 11 by trevor.p...@gmail.com: current trunk fails to
Can you provide the full command line that causes this error? I would like
to try to reproduce this on my end if possible.

mock...@googlecode.com

unread,
Jan 9, 2013, 4:22:10 PM1/9/13
to mockit...@googlegroups.com

Comment #2 on issue 11 by plaztiks...@gmail.com: current trunk fails to
/opt/gcc-google-4.7-v7-testing/bin/g++ -MMD -MP -MF
protocol/http/appblade/http_cfe_blade_test.d
-MT "protocol/http/appblade/http_cfe_blade_test.o
protocol/http/appblade/http_cfe_blade_test.po
protocol/http/appblade/http_cfe_blade_test.covo" -o
protocol/http/appblade/http_cfe_blade_test.o -c -g3 -gdwarf-2 -ggdb
-std=gnu++11 -O3 -march=native -mtune=bdver2 -flto -finline-functions
-fno-strict-aliasing -DRBT_OPTIMIZE=1 -fno-builtin-malloc -fno-builtin-free
-fno-builtin-realloc -fno-builtin-calloc -fno-builtin-cfree
-fno-builtin-memalign -fno-builtin-posix_memalign -fno-builtin-valloc
-fno-builtin-pvalloc -Wall -W -Wunused -Wno-parentheses -fmessage-length=0
-Wno-trigraphs -fpermissive -D_GNU_SOURCE -D_REENTRANT -DLinux -DNDEBUG=1
-DUSE_PTHREADS -I/work/mhargett/sport-trunk/protocol/lib/cgreen/include
-I/work/mhargett/sport-trunk/protocol/lib/mockitopp/include
protocol/http/appblade/http_cfe_blade_test.cc

I can also send you the preprocessed output privately, if that helps.

mock...@googlecode.com

unread,
Jan 10, 2013, 9:37:04 PM1/10/13
to mockit...@googlegroups.com

Comment #3 on issue 11 by plaztiks...@gmail.com: current trunk fails to
This example shows the problem with g++ 4.4, 4.7, and 4.8 (trunk) with and
without -std=gnu++11:

#include <mockitopp/mock_object.hpp>
using namespace mockitopp;

class Foo {
public:
virtual bool do_something() = 0;
};

class Bar : virtual public Foo {};

int
main(int, char **)
{
mock_object<Bar> mock_baz;
mock_baz.expect(&Bar::do_something).never();
mock_baz.getInstance().do_something();
return 0;
}

output:
In file included from
protocol/lib/mockitopp/include/mockitopp/detail/stubbing/dynamic_object.hpp:5:0,
from
protocol/lib/mockitopp/include/mockitopp/mock_object.hpp:4,
from m.cc:1:
protocol/lib/mockitopp/include/mockitopp/detail/stubbing/dynamic_vfunction.hpp:
In
function \u2018int main(int, char**)\u2019:
protocol/lib/mockitopp/include/mockitopp/detail/stubbing/dynamic_vfunction.hpp:65:15:
error:
\u2018bool mockitopp::detail::dynamic_vfunction_base::never()
const\u2019 is inaccessible
bool never() const
^
m.cc:15:47: error: within this context
mock_baz.expect(&Bar::do_something).never();
^
m.cc:15:47: error: \u2018mockitopp::detail::dynamic_vfunction_base\u2019 is
not an accessible base of \u2018mockitopp::detail::dynamic_vfunction<bool
(Foo::*)()>\u2019
mhargett@pyrite:/work/mhargett/sport-trunk$ g++ -Wall -Wextra
-Iprotocol/lib/mockitopp/include/ m.cc
protocol/lib/mockitopp/include/mockitopp/detail/stubbing/dynamic_vfunction.hpp:
In
function \u2018int main(int, char**)\u2019:
protocol/lib/mockitopp/include/mockitopp/detail/stubbing/dynamic_vfunction.hpp:65:
error:
\u2018bool mockitopp::detail::dynamic_vfunction_base::never()
const\u2019 is inaccessible
m.cc:15: error: within this context
m.cc:15: error: \u2018mockitopp::detail::dynamic_vfunction_base\u2019 is
not an accessible base of \u2018mockitopp::detail::dynamic_vfunction<bool
(Foo::*)()>\u2019


mock...@googlecode.com

unread,
Mar 7, 2013, 4:18:51 PM3/7/13
to mockit...@googlegroups.com
Updates:
Status: Invalid

Comment #4 on issue 11 by plaztiks...@gmail.com: current trunk fails to
Then when() is always necessary:
mock.when().never();
versus
mock.never();

while it would be nice to not have to supply then when() if it's a void
argument list, it's not a defect. we should be sure this is underscored in
the documentation, as the compiler error is a bit misleading.

--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
Reply all
Reply to author
Forward
0 new messages