This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[c++] template instantiation confusion
- To: gcc-bugs at gcc dot gnu dot org, mark at codesourcery dot com, jason at cygnus dot com
- Subject: [c++] template instantiation confusion
- From: Benjamin Kosnik <bkoz at redhat dot com>
- Date: Wed, 23 Aug 2000 02:55:57 -0700
The following testcase deliberately does not link:
/tmp/cckzpCGh.o: In function `main':
/mnt/hd/bliss/src.gcc/libstdc++-v3/testsuite/22_locale/test1.cc:35: undefined reference to `bool std::has_facet<std::codecvt<unsigned short, unsigned wchar_t, std::__enc_traits> >(std::locale const &)'
collect2: ld returned 1 exit status
Notice the instantiation expected is:
std::codecvt<unsigned short, wchar_t, std::__enc_traits>
not
std::codecvt<unsigned short, unsigned wchar_t, std::__enc_traits>
?
This was working with g++-2.95.2, but is currently broken:
g++-2.95.2:
U has_facet__H1Zt7codecvt3ZUsZwZ12__enc_traits_RC6locale_b
U bool has_facet<codecvt<unsigned short, wchar_t, __enc_traits> >(locale const &)
gcc version 2.96 20000820 (experimental):
U has_facet__H1ZQ23stdt7codecvt3ZUsZUwZQ23std12__enc_traits_3stdRCQ23std6locale_b
U bool std::has_facet<std::codecvt<unsigned short, unsigned wchar_t, std::__enc_traits> >(std::locale const &)
-benjamin
Here's the testcase:
// 2000-08-22 Benjamin Kosnik <bkoz@cygnus.com>
using namespace std;
namespace std
{
class locale
{ };
class __enc_traits
{ };
template<typename _InternT, typename _ExternT, typename _StateT>
class codecvt
{ };
template<typename _Facet>
bool
has_facet(const locale& __loc) throw();
}
int main()
{
typedef unsigned short unicode_t;
typedef unicode_t int_type;
typedef wchar_t ext_type;
typedef __enc_traits enc_type;
typedef codecvt<int_type, ext_type, enc_type> unicode_codecvt;
locale loc;
has_facet<unicode_codecvt>(loc);
}