Boost logo

Boost Users :

Subject: Re: [Boost-users] [test] testing protected/private methods out of test suits
From: Robert Mecklenburg (rmecklenburg_at_[hidden])
Date: 2008-09-22 14:44:01


Jonathan Franklin writes:
> > On Friday 19 September 2008 21:37:01 trashing_at_[hidden] wrote:
> >
> > > I've exactly that problem with MSVC++7.x. Compiling the class_to_test in
> > > the library with protected methods and trying to access this methods out
> > > from the test_case_class by including the header and #define protected
> > > public, gives me a "symbol not found compiler error". :-/
> >
> > Yes, that trick will not work with msvc because the access
> > specifiers (public, protected, private) get into the mangled name
> > in the lib. So you are out of luck here ;-((
>
> The '#define private public' trick works for me using MSVS 2005 and static
> libraries.

I would swear that the standard indicated that public/private had no
effect on visibility, just accessibility. That is, changing a
symbol's access from private to public did not change the meaning of a
program. Stroustrup uses such language in the D&E of C++.

Obviously, Microsoft thinks differently.

Cheers,

-- 
Robert

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net