Boost logo

Boost :

Subject: [boost] [Boost-Test] Patch xml_log_formatter.hpp for sun-5.9 on Linux
From: K. Noel Belcourt (kbelco_at_[hidden])
Date: 2008-09-08 14:43:11


Hi,

Attached is a patch to fix this problem with Boost.test trunk and
sun-5.9 on Linux.

sun.compile.c++ ../../../bin.v2/libs/test/build/sun-5.9/debug/link-
static/unit_test_main.o

"../../../boost/test/impl/unit_test_main.ipp", line 115: Error: Could
not find a match for
std::vector<boost::unit_test::test_case_filter::single_filter>::vector
(boost::unit_test::basic_string_token_iterator<char,
boost::unit_test::ut_detail::default_char_compare<char>>,
boost::unit_test::basic_string_token_iterator<char,
boost::unit_test::ut_detail::default_char_compare<char>>) needed in
boost::unit_test::test_case_filter::test_case_filter
(boost::unit_test::basic_cstring<const char>).

"../../../boost/test/impl/unit_test_main.ipp", line 115: Error:
Formal argument x of type const
std::vector<boost::unit_test::test_case_filter::single_filter>& in
call to
std::vector<std::vector<boost::unit_test::test_case_filter::single_filte
r> >::push_back(const
std::vector<boost::unit_test::test_case_filter::single_filter>&) is
being passed int.
2 Error(s) detected.

     "/home/sntools/extras/compilers/studio12/sunstudio12/bin/CC" +d -
g -DBOOST_ALL_NO_LIB=1 -I"../../.." -c -o "../../../bin.v2/libs/test/
build/sun-5.9/debug/link-static/unit_test_main.o" "../../../libs/test/
src/unit_test_main.cpp"

The patch adds a using declaration to bring the base class function
into the overload set.

Sun's interpretation of the standard seems to be correct, from what I
can tell. Here's their rational:

[ from their sun-5.9 FAQ ]

Q. Why does the compiler say that a derived-class virtual function
hides a base-class virtual function with a different signature? My
other compiler doesn't complain about the code.

A. The C++ rule is that overloading occurs only within one scope,
never across scopes. A base class is considered to be in a scope that
surrounds the scope of a derived class. Any name declared in a
derived class therefore hides, and cannot overload, any function in a
base class. This fundamental C++ rule predates the ARM.

If another compiler does not complain, it is doing you a disservice,
because the code will not behave as you probably expect. Our compiler
issues a warning while accepting the code. (The code is legal, but
probably does not do what you want.)

If you wish to include base-class functions in an overloaded set, you
must do something to bring the base-class functions into the current
scope. If you are compiling in default standard mode, you can add a
using-declaration:

Okay to commit to trunk?

-- Noel






Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk