[libcxx] r269838 - Test hijacking ADL for operator& in the stream iterator constructors.
Eric Fiselier via cfe-commits
cfe-commits at lists.llvm.org
Tue May 17 14:01:20 PDT 2016
Author: ericwf
Date: Tue May 17 16:01:20 2016
New Revision: 269838
URL: http://llvm.org/viewvc/llvm-project?rev=269838&view=rev
Log:
Test hijacking ADL for operator& in the stream iterator constructors.
Modified:
libcxx/trunk/test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.cons.des/ostream.pass.cpp
libcxx/trunk/test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.cons.des/ostream_delim.pass.cpp
Modified: libcxx/trunk/test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.cons.des/ostream.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.cons.des/ostream.pass.cpp?rev=269838&r1=269837&r2=269838&view=diff
==============================================================================
--- libcxx/trunk/test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.cons.des/ostream.pass.cpp (original)
+++ libcxx/trunk/test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.cons.des/ostream.pass.cpp Tue May 17 16:01:20 2016
@@ -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());
+ }
}
Modified: libcxx/trunk/test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.cons.des/ostream_delim.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.cons.des/ostream_delim.pass.cpp?rev=269838&r1=269837&r2=269838&view=diff
==============================================================================
--- libcxx/trunk/test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.cons.des/ostream_delim.pass.cpp (original)
+++ libcxx/trunk/test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.cons.des/ostream_delim.pass.cpp Tue May 17 16:01:20 2016
@@ -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());
+ }
}
More information about the cfe-commits
mailing list