stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Travis Vitek" <>
Subject RE: svn commit: r573119 - /incubator/stdcxx/trunk/tests/regress/24.operations.stdcxx-234.cpp
Date Fri, 14 Sep 2007 07:15:51 GMT

> Martin Sebor wrote:
>Travis Vitek wrote:
>> 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 :)

Done. [14.7.3 p10]

>> 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:

Well I was compiling with gcc 3.4.6, and your testcase is different from
what we have here. I _believe_ that the gcc testcase you provided is
explicitly instantiating the foo() template on int. That is very
different from the problem I'm describing.

I don't really think this is a gcc bug [but it is likely to be a msvc
bug]. From the 2003 version of the standard...

[14.7.3 p2] An explicit specialization shall be declared in the
of which the template is a member, or, for member templates, [...] Such
declaration may also be a definition. If the declaration is not a
definition, the specialization may be defined later (

[ p2] Members (including explicit specializations of templates
(14.7.3)) of a named namespace can be defined outside that namespace by
explicit qualification ( of the name being defined, provided
the entity being defined was already declared in the namespace and the
declaration appears after the point of declaration in a namespace that
encloses the declaratsion's namespace. [Example:

    namespace Q {
        namespace V {
            void f();
        void V::f() { /*...*/ }  // OK
        void V::g() { /*...*/ }  // error: g() is not yet a member of V
        namespace V {
            void g();

    namespace R {
        void Q::V::g() { /*...*/ } // error: R doesn't enclose Q


View raw message