Re: [boost] Now config macro : BOOST_NO_TWO_PHASE_NAME_LOOKUP

Hello, I just extended this test case with struct derived2 and made function call() as virtual. Question: should function test output "2"? if no: how to get this(2) result? I don't think that developer should make a call using "this->" in the struct derived. Modified test case: template< class T > struct base { virtual int call() { return 1; } }; int call() { return 0; } template< class T > struct derived : base< T > { int call_test() { return call(); } }; template< class T > struct derived2 : derived< T > { virtual int call() { return 2; } }; int test() { derived2< int > d; return d.call_test(); } Tomas AlisdairM wrote:
I have just supplied John with a new defect macro and test case to detect compilers that (do not) support 2-phase name lookup with templates, but it would be really helpful if someone who is more familiar with the problem (and access to conforming compilers!) can verify the test for us!
The test case is in
boost/libs/config/boost_no_two_phase_name_lookup.ipp
and currently the code looks like:
template< class T > struct base { int call() { return 1; } };
int call() { return 0; }
template< class T > struct derived : base< T > { int call_test() { return call(); } };
int test() { derived< int > d; return d.call_test(); }
I believe a conforming compiler should only find the 'free' function, where a broken compiler will typically call the function from its base class template.
Also, beware of config test failures until the various compiler config headers are updated. This should also give us a good idea of whether the right compilers are being flagged!

Tomas Rapkauskas <slidertom@gmail.com> writes:
Hello, I just extended this test case with struct derived2 and made function call() as virtual. Question: should function test output "2"? if no: how to get this(2) result? I don't think that developer should make a call using "this->" in the struct derived.
Isn this really just a C++ question, not related to Boost or library development? If so, please take it to an appropriate forum like comp.std.c++[.moderated]. Thanks, -- Dave Abrahams Boost Consulting www.boost-consulting.com
participants (2)
-
David Abrahams
-
Tomas Rapkauskas