Trouble with std::basic_ostringstream and libc++
Trouble with std::basic_ostringstream and libc++
- Subject: Trouble with std::basic_ostringstream and libc++
- From: Jesper Papmehl-Dufay <email@hidden>
- Date: Mon, 09 Jul 2012 16:15:35 +0200
I am having trouble getting code that uses std::basic_ostringstream to work when building with libc++. The same code works without any problems when building using libstdc++. (In both cases I’m building with Xcode 4.3.3, Apple LLVM compiler 3.1, and C++ Language Dialect set to C++11.)
For example, the following program fails to compile:
#include <sstream>
int main(int argc, const char* argv[]) {
std::basic_ostringstream<int> myStream;
return 0;
}
with the error messages listed at the end of this mail.
If I change std::basic_ostringstream<int> to std::ostringstream, it builds with our any problems (though I actually need a specific character type, so I cannot use ostringstream in my real program).
And if I change the standard C++ library to libstdc++, it also builds without any problems.
Does anyone have any idea what I might be doing wrong? Or is this simply a bug in libc++?
Thanks!
/Jesper
-----------
In file included from /Users/pappis/Desktop/streamtest/streamtest/main.cpp:1:
In file included from /Applications/Xcode 4.3.3.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/sstream:174:
In file included from /Applications/Xcode 4.3.3.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/ostream:130:
/Applications/Xcode 4.3.3.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/ios:724:50: error: implicit instantiation of undefined template 'std::__1::ctype<int>'
return use_facet<ctype<char_type> >(getloc()).widen(__c);
^
/Applications/Xcode 4.3.3.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/ios:660:15: note: in instantiation of member function 'std::__1::basic_ios<int, std::__1::char_traits<int> >::widen' requested here
__fill_ = widen(' ');
^
/Applications/Xcode 4.3.3.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/ostream:264:11: note: in instantiation of member function 'std::__1::basic_ios<int, std::__1::char_traits<int> >::init' requested here
this->init(__sb);
^
/Applications/Xcode 4.3.3.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/sstream:688:7: note: in instantiation of member function 'std::__1::basic_ostream<int, std::__1::char_traits<int> >::basic_ostream' requested here
: basic_ostream<_CharT, _Traits>(&__sb_),
^
/Users/pappis/Desktop/streamtest/streamtest/main.cpp:4:32: note: in instantiation of member function 'std::__1::basic_ostringstream<int, std::__1::char_traits<int>, std::__1::allocator<int> >::basic_ostringstream' requested here
std::basic_ostringstream<int> myStream;
^
/Applications/Xcode 4.3.3.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/__locale:369:47: note: template is declared here
template <class _CharT> class _LIBCPP_VISIBLE ctype;
^
/Applications/Xcode 4.3.3.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/__locale:164:54: error: implicit instantiation of undefined template 'std::__1::ctype<int>'
return static_cast<const _Facet&>(*__l.use_facet(_Facet::id));
^
/Applications/Xcode 4.3.3.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/ios:724:12: note: in instantiation of function template specialization 'std::__1::use_facet<std::__1::ctype<int> >' requested here
return use_facet<ctype<char_type> >(getloc()).widen(__c);
^
/Applications/Xcode 4.3.3.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/ios:660:15: note: in instantiation of member function 'std::__1::basic_ios<int, std::__1::char_traits<int> >::widen' requested here
__fill_ = widen(' ');
^
/Applications/Xcode 4.3.3.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/ostream:264:11: note: in instantiation of member function 'std::__1::basic_ios<int, std::__1::char_traits<int> >::init' requested here
this->init(__sb);
^
/Applications/Xcode 4.3.3.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/sstream:688:7: note: in instantiation of member function 'std::__1::basic_ostream<int, std::__1::char_traits<int> >::basic_ostream' requested here
: basic_ostream<_CharT, _Traits>(&__sb_),
^
/Users/pappis/Desktop/streamtest/streamtest/main.cpp:4:32: note: in instantiation of member function 'std::__1::basic_ostringstream<int, std::__1::char_traits<int>, std::__1::allocator<int> >::basic_ostringstream' requested here
std::basic_ostringstream<int> myStream;
^
/Applications/Xcode 4.3.3.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/__locale:369:47: note: template is declared here
template <class _CharT> class _LIBCPP_VISIBLE ctype;
^
2 errors generated.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden