This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/36151] gcc fails to find template specializations within namespace
- From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 6 May 2008 15:44:02 -0000
- Subject: [Bug c++/36151] gcc fails to find template specializations within namespace
- References: <bug-36151-16154@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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