Test hijacking ADL for operator& in the stream iterator constructors.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@269838 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -17,9 +17,23 @@
|
||||
#include <sstream>
|
||||
#include <cassert>
|
||||
|
||||
struct MyTraits : std::char_traits<char> {};
|
||||
|
||||
typedef std::basic_ostringstream<char, MyTraits> StringStream;
|
||||
typedef std::basic_ostream<char, MyTraits> BasicStream;
|
||||
|
||||
void operator&(BasicStream const&) {}
|
||||
|
||||
int main()
|
||||
{
|
||||
std::ostringstream outf;
|
||||
std::ostream_iterator<int> i(outf);
|
||||
assert(outf.good());
|
||||
{
|
||||
std::ostringstream outf;
|
||||
std::ostream_iterator<int> i(outf);
|
||||
assert(outf.good());
|
||||
}
|
||||
{
|
||||
StringStream outf;
|
||||
std::ostream_iterator<int, char, MyTraits> i(outf);
|
||||
assert(outf.good());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,14 @@
|
||||
#include <sstream>
|
||||
#include <cassert>
|
||||
|
||||
|
||||
struct MyTraits : std::char_traits<char> {};
|
||||
|
||||
typedef std::basic_ostringstream<char, MyTraits> StringStream;
|
||||
typedef std::basic_ostream<char, MyTraits> BasicStream;
|
||||
|
||||
void operator&(BasicStream const&) {}
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
@@ -29,4 +37,9 @@ int main()
|
||||
std::ostream_iterator<double, wchar_t> i(outf, L", ");
|
||||
assert(outf.good());
|
||||
}
|
||||
{
|
||||
StringStream outf;
|
||||
std::ostream_iterator<int, char, MyTraits> i(outf, ", ");
|
||||
assert(outf.good());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user