This is the mail archive of the
libstdc++-prs@sourceware.cygnus.com
mailing list for the libstdc++ project.
libstdc++/22: g++ cannot compile std::ostream_iterator<std::pair<int, int> >
- To: libstdc++-gnats at sourceware dot cygnus dot com
- Subject: libstdc++/22: g++ cannot compile std::ostream_iterator<std::pair<int, int> >
- From: cshihpin at dso dot org dot sg
- Date: 7 Jan 2000 14:53:33 -0000
- Reply-To: cshihpin at dso dot org dot sg
- Resent-Cc: libstdc++-prs at sourceware dot cygnus dot com
- Resent-Reply-To: libstdc++-gnats@sourceware.cygnus.com, cshihpin@dso.org.sg
>Number: 22
>Category: libstdc++
>Synopsis: g++ cannot compile std::ostream_iterator<std::pair<int, int> >
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Jan 07 06:57:00 PST 2000
>Closed-Date:
>Last-Modified:
>Originator: Richard Chan
>Release: unknown-1.0
>Organization:
>Environment:
Linux RedHat 6.1, kernel 2.2.14
gcc-2.95.2/libgcc.a and libstdc++-2.90.7 compiled with -fhonor-std
and --enable-namespaces
>Description:
With -fhonor-std and --enable-namespaces g++ cannot compile
a operator<< function using ostream_iterator.
1. Define an overloaded function
std::ostream& operator<<(std::ostream&, const std::pair<int, int>&)
2. Try printing pairs - works!
std::pair<int, int> p(12,34);
std::cout << p; //this is OK; compiles and runs correctly
3. Try printing pair using std::ostream_iterator
std::ostream_iterator<pair<int, int> > out(std::cout, "\n");
*out = p; //this does not compile!! Compiler cannot find
// operator<< function
// library is built with --enable-namespaces
// using -fhonor-std
>How-To-Repeat:
c++ -fhonor-std -c bugfile.cc
does not compile
>Fix:
No fix
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="bugfile.cc"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="bugfile.cc"
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dXRpbGl0eT4KI2luY2x1ZGUgPGl0ZXJhdG9y
PgoKc3RkOjpvc3RyZWFtJgpvcGVyYXRvcjw8KHN0ZDo6b3N0cmVhbSYgb3MsIHN0ZDo6cGFpcjxp
bnQsIGludD4gcCkKewoJcmV0dXJuIG9zIDw8IHAuZmlyc3QgPDwgJyAnIDw8IHAuc2Vjb25kOwp9
CgptYWluKCkKewoJc3RkOjpwYWlyPGludCwgaW50PiBwKDEyLDM0KTsKCXN0ZDo6b3N0cmVhbV9p
dGVyYXRvcjxzdGQ6OnBhaXI8aW50LCBpbnQ+ID4gb3V0KHN0ZDo6Y291dCwgIlxuIik7CgoJc3Rk
Ojpjb3V0IDw8IHAgPDwgc3RkOjplbmRsOwoJKm91dCA9IHA7IC8vIHRoaXMgZG9lcyBub3QgY29t
cGlsZSEKfQoJCg==