stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Sebor <se...@roguewave.com>
Subject Re: svn commit: r573119 - /incubator/stdcxx/trunk/tests/regress/24.operations.stdcxx-234.cpp
Date Thu, 13 Sep 2007 00:03:42 GMT
Travis Vitek wrote:
>  
> This regression test fails to compile on more than one platform for
> varying reasons.
> 
>     ..\..\..\..\tests\containers\t.cpp(9) : error C2785:
> 'iterator_traits<_Iterator>::difference_type
> std::distance(_ForwardIterator,_ForwardIterator)' and 'int
> distance(X,X)' have different return types
>         c:\build\stdcxx\include\rw/_iterbase.h(341) : see declaration of
> 'std::distance'
>         ..\..\..\..\tests\containers\t.cpp(9) : see declaration of
> 'distance'
>     ..\..\..\..\tests\containers\t.cpp(9) : error C2244: 'std::distance'
> : unable to match function definition to an existing declaration
> 
> It appears that MSVC doesn't like that you haven't provided the template
> parameter types for the specialization of distance().

Looks like a compiler bug. We should report it to Microsoft.
If you don't have one yet, this might be a good opportunity
to set up an account with them and learn how to do it :)

Here's the URL:
https://connect.microsoft.com/

> 
>  
> /amd/devco/vitek/stdcxx/trunk/tests/regress/24.operations.stdcxx-234.cpp
> :38: error: specialization of `template<class _ForwardIterator> typename
> std::iterator_traits::difference_type std::distance(_ForwardIterator,
> _ForwardIterator)' in different namespace
>   /amd/devco/vitek/stdcxx/trunk/include/rw/_iterbase.h:342: error:
> from definition of `template<class _ForwardIterator> typename
> std::iterator_traits::difference_type std::distance(_ForwardIterator,
> _ForwardIterator)'
>   gmake: *** [24.operations.stdcxx-234.o] Error 1
> 
> It looks like gcc doesn't like how you've put the distance()
> specialization into namespace std. It appears that this is supposed to
> be legal [14.7.3 p9], but gcc rejects the code.

Yes, it's a gcc 3.2 bug. We reported it back in 2002:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=8266

> 
> I'm attaching a patch that I've tested on VC8 and gcc 3.4.6. It should
> also compile on.

Committed thus:
http://svn.apache.org/viewvc?rev=575132&view=rev

Thanks!
Martin


Mime
View raw message