This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
unnamed namespaces and specializations
- From: Benjamin Kosnik <bkoz at redhat dot com>
- To: mark at codesourcery dot com
- Cc: jason at redhat dot com, gdr at integrable-solutions dot net, libstdc++ at gcc dot gnu dot org
- Date: Fri, 1 Aug 2003 10:54:17 -0500
- Subject: unnamed namespaces and specializations
I would dearly love it if this code below is valid.
I'm getting conflicting reports: g++ says no, icc says yes. I'm not
quite certain myself, after reading 7.3.1.1 - Unnamed namespaces and
the other bits.
Thoughts?
%g++ -c namespace_issues_3.cc
namespace_issues_3.cc:32: error: specializing `class
std::<unnamed>::vector<useless>' in different namespace
namespace_issues_3.cc:9: error: from definition of `template<class _T> class
std::<unnamed>::vector'
-benjamin
namespace std
{
namespace
{
template<typename _T>
class vector
{
public:
int foo() { return 5; }
};
}
}
struct useless { };
// Want to specialize here.
namespace std
{
template<>
class vector<useless>
{
public:
int foo() { return 7; }
};
}
int main()
{
std::vector<useless> v;
int i = v.foo();
return 0;
}