This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/36151] gcc fails to find template specializations within namespace



------- Comment #1 from pinskia at gcc dot gnu dot org  2008-05-06 15:44 -------
This is correct behavior.


        template<class T> void bar( T& v )              { v.foo(); }
        template<class T> void bar( B<T>& x )           { bar( *x ); }
        template<class T> void bar( A<T>& x )           { bar( *x ); }

Since A<T> is not in the namespace N, the second bar only sees itself and the
first bar (in its overloaded set).

If you want working code use the following:
namespace N {
        template<class T> void bar( T& v );
        template<class T> void bar( B<T>& x );
        template<class T> void bar( A<T>& x );
        template<class T> void bar( T& v )              { v.foo(); }
        template<class T> void bar( B<T>& x )           { bar( *x ); }
        template<class T> void bar( A<T>& x )           { bar( *x ); }
}


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36151


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]