Boost logo

Boost :

From: Samuel Krempp (krempp_at_[hidden])
Date: 2005-02-23 07:50:42


François Dumont wrote:

> Config: STLport 5.0 beta and MSVC 8 (but also reported with 7.1)
>
> It looks like this compiler has a problem with the relation between
> the basic_string::size_type and basic_format::size_type as soon as the
> library is not the native one. Here is a patch proposition that return
> a basic_string::size_type rather than the basic_format::size_type. I
> think it is quite a secure patch as the method is already using a
> static_cast<typename string_type::size_type> to return its result and
> not a simple static_cast<size_type>.
>
> Bests

This reported error is weird, I'm trying to get MSVC 7.1 or 8 to
experiment on it.

Is anyone aware of issues with recent MSVCs about chained typedefs ? in
a template situation ?

The situation is :
in format_class.hpp :

namespace boost {

template<class Ch, class Tr, class Alloc>
class basic_format {
...
        typedef std::basic_string<Ch, Tr, Alloc> string_type;
        typedef typename string_type::size_type size_type;
..
        size_type size() const;
}

And, in format_implementation.hpp :

namespace boost {
    template< class Ch, class Tr, class Alloc>
    typename basic_format<Ch, Tr, Alloc>::size_type basic_format<Ch,Tr,
Alloc>::
    size () const {
       ... definition ...
    }

And, apparently, the error (with MSVC 7.1, STL 4.6.2, Boost 1.32) :

\boost\format\format_implementation.hpp(216) : error
C2244: 'boost::basic_format<Ch,Tr,Alloc>::size' : unable
to match function definition to an existing declaration

\boost\format\format_class.hpp(58) : see declaration
of 'boost::basic_format<Ch,Tr,Alloc>::size'
        definition
        'basic_format<Ch,Tr,Alloc>::size_type
boost::basic_format<Ch,Tr,Alloc>::size(void) const'
        existing declarations
        'boost::basic_format<Ch,Tr,Alloc>::size_type
boost::basic_format<Ch,Tr,Alloc>::size(void) const'

If it works when replacing all mentions of size_type with
typename std::basic_string<Ch, Tr, Alloc>::string_type, I could do that,
but finding what was happening could be useful anyway.

-- 
Samuel

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