This is the mail archive of the gcc@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]

[RFH] Puzzling behaviour with a wstring constructor


Hi,

with current mainline (vs 3.2.2, 3.3 pre) the following doesn't link:

 // template<typename _InputIter>
 //   basic_string(_InputIter begin, _InputIter end, const allocator& a)
 // where _InputIter is integral [21.3.1 para 15]
 std::wstring s(10, 0);

/tmp/ccxyBSk4.o: In function `wchar_t* std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::_S_construct_aux<int>(int, int, std::allocator<wchar_t> const&, __true_type)':
/tmp/ccxyBSk4.o(.gnu.linkonce.t._ZNSbIwSt11char_traitsIwESaIwEE16_S_construct_auxIiEEPwT_S5_RKS1_11__true_type+0x1b): undefined reference to `std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::_S_construct(unsigned, wchar_t, std::allocator<wchar_t> const&)'
collect2: ld returned 1 exit status


On the other hand the string version is ok.
Also, FWIW, are both ok:

std::wstring s((unsigned)10, 0);

and

std::wstring s(10, (unsigned)0);

I'm really puzzled: is the testcase above (which I blindly adapted from the string version) correct or must be amended?

Thanks for any feedback,
Paolo.

P.S. EDG + Dinkum also compile it just fine.


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