public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: jstanek@vrac.iastate.edu To: gcc-gnats@gcc.gnu.org Cc: jstanek@iastate.edu Subject: c++/8567: std::endl is of unknown type when overloading operator<< (repeat in case attachment didnt work) Date: Wed, 20 Nov 2002 04:46:00 -0000 [thread overview] Message-ID: <20021113213117.27634.qmail@sources.redhat.com> (raw) >Number: 8567 >Category: c++ >Synopsis: std::endl is of unknown type when overloading operator<< (repeat in case attachment didnt work) >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: support >Submitter-Id: net >Arrival-Date: Wed Nov 13 13:36:01 PST 2002 >Closed-Date: >Last-Modified: >Originator: Jason Stanek >Release: gcc-3.2 >Organization: >Environment: cruncher 110% uname -a IRIX64 cruncher 6.5 07121149 IP27 cruncher 109% g++32 -v -save-temps Unknown.cpp Reading specs from /home/users/jstanek/gcc-3.2/irix/lib/gcc-lib/mips-sgi-irix6.5/3.2/specs Configured with: ../gcc-3.2-src/configure --prefix=/home/users/jstanek/gcc-3.2 --exec-prefix=/home/users/jstanek/gcc-3.2/irix Thread model: single gcc version 3.2 /home/users/jstanek/gcc-3.2/irix/lib/gcc-lib/mips-sgi-irix6.5/3.2/cpp0 -lang-c++ -D__GNUG__=3 -D__DEPRECATED -D__EXCEPTIONS -v -D__GNUC__=3 -D__GNUC_MINOR__=2 -D__GNUC_PATCHLEVEL__=0 -D__GXX_ABI_VERSION=102 -Dunix -Dmips -Dsgi -Dhost_mips -DMIPSEB -D_MIPSEB -DSYSTYPE_SVR4 -D_LONGLONG -D_SVR4_SOURCE -D_MODERN_C -D__DSO__ -D__unix__ -D__mips__ -D__sgi__ -D__host_mips__ -D__MIPSEB__ -D_MIPSEB -D__SYSTYPE_SVR4__ -D_LONGLONG -D_SVR4_SOURCE -D_MODERN_C -D__DSO__ -D__unix -D__mips -D__sgi -D__host_mips -D__MIPSEB -D__SYSTYPE_SVR4 -Asystem=unix -Asystem=svr4 -Acpu=mips -Amachine=sgi -D__NO_INLINE__ -D__STDC_HOSTED__=1 -D__LANGUAGE_C_PLUS_PLUS -D_LANGUAGE_C_PLUS_PLUS -D__SIZE_TYPE__=unsigned int -D__PTRDIFF_TYPE__=int -D__WCHAR_TYPE__=long int -D__WINT_TYPE__=long int -D__mips_fpr=64 -D__EXTENSIONS__ -D_SGI_SOURCE -D_MIPS_FPSET=32 -D_MIPS_ISA=_MIPS_ISA_MIPS3 -D_ABIN32=2 -D_MIPS_SIM=_ABIN32 -D_MIPS_SZINT=32 -D_MIPS_SZLONG=32 -D_MIPS_SZPTR=32 -D_COMPILER_VERSION=601 -U__mips -D__mips=3 -D__mips64 Unknown.cpp Unknown.ii GNU CPP version 3.2 (cpplib) [AL 1.1, MM 40] SGI running IRIX 6.x ignoring nonexistent directory "/home/users/jstanek/gcc-3.2/irix/mips-sgi-irix6.5/include" #include "..." search starts here: #include <...> search starts here: /home/users/jstanek/gcc-3.2/include/c++/3.2 /home/users/jstanek/gcc-3.2/include/c++/3.2/mips-sgi-irix6.5 /home/users/jstanek/gcc-3.2/include/c++/3.2/backward /usr/local/include /home/users/jstanek/gcc-3.2/include /home/users/jstanek/gcc-3.2/irix/lib/gcc-lib/mips-sgi-irix6.5/3.2/include /usr/include End of search list. /home/users/jstanek/gcc-3.2/irix/lib/gcc-lib/mips-sgi-irix6.5/3.2/cc1plus -fpreprocessed Unknown.ii -quiet -dumpbase Unknown.cpp -version -o Unknown.s GNU CPP version 3.2 (cpplib) [AL 1.1, MM 40] SGI running IRIX 6.x GNU C++ version 3.2 (mips-sgi-irix6.5) compiled by GNU C version 3.2. Unknown.cpp: In function `int main()': Unknown.cpp:25: no match for `BlackHole& << <unknown type>' operator >Description: cruncher 109% g++32 -v -save-temps Unknown.cpp Reading specs from /home/users/jstanek/gcc-3.2/irix/lib/gcc-lib/mips-sgi-irix6.5/3.2/specs Configured with: ../gcc-3.2-src/configure --prefix=/home/users/jstanek/gcc-3.2 --exec-prefix=/home/users/jstanek/gcc-3.2/irix Thread model: single gcc version 3.2 /home/users/jstanek/gcc-3.2/irix/lib/gcc-lib/mips-sgi-irix6.5/3.2/cpp0 -lang-c++ -D__GNUG__=3 -D__DEPRECATED -D__EXCEPTIONS -v -D__GNUC__=3 -D__GNUC_MINOR__=2 -D__GNUC_PATCHLEVEL__=0 -D__GXX_ABI_VERSION=102 -Dunix -Dmips -Dsgi -Dhost_mips -DMIPSEB -D_MIPSEB -DSYSTYPE_SVR4 -D_LONGLONG -D_SVR4_SOURCE -D_MODERN_C -D__DSO__ -D__unix__ -D__mips__ -D__sgi__ -D__host_mips__ -D__MIPSEB__ -D_MIPSEB -D__SYSTYPE_SVR4__ -D_LONGLONG -D_SVR4_SOURCE -D_MODERN_C -D__DSO__ -D__unix -D__mips -D__sgi -D__host_mips -D__MIPSEB -D__SYSTYPE_SVR4 -Asystem=unix -Asystem=svr4 -Acpu=mips -Amachine=sgi -D__NO_INLINE__ -D__STDC_HOSTED__=1 -D__LANGUAGE_C_PLUS_PLUS -D_LANGUAGE_C_PLUS_PLUS -D__SIZE_TYPE__=unsigned int -D__PTRDIFF_TYPE__=int -D__WCHAR_TYPE__=long int -D__WINT_TYPE__=long int -D__mips_fpr=64 -D__EXTENSIONS__ -D_SGI_SOURCE -D_MIPS_FPSET=32 -D_MIPS_ISA=_MIPS_ISA_MIPS3 -D_ABIN32=2 -D_MIPS_SIM=_ABIN32 -D_MIPS_SZINT=32 -D_MIPS_SZLONG=32 -D_MIPS_SZPTR=32 -D_COMPILER_VERSION=601 -U__mips -D__mips=3 -D__mips64 Unknown.cpp Unknown.ii GNU CPP version 3.2 (cpplib) [AL 1.1, MM 40] SGI running IRIX 6.x ignoring nonexistent directory "/home/users/jstanek/gcc-3.2/irix/mips-sgi-irix6.5/include" #include "..." search starts here: #include <...> search starts here: /home/users/jstanek/gcc-3.2/include/c++/3.2 /home/users/jstanek/gcc-3.2/include/c++/3.2/mips-sgi-irix6.5 /home/users/jstanek/gcc-3.2/include/c++/3.2/backward /usr/local/include /home/users/jstanek/gcc-3.2/include /home/users/jstanek/gcc-3.2/irix/lib/gcc-lib/mips-sgi-irix6.5/3.2/include /usr/include End of search list. /home/users/jstanek/gcc-3.2/irix/lib/gcc-lib/mips-sgi-irix6.5/3.2/cc1plus -fpreprocessed Unknown.ii -quiet -dumpbase Unknown.cpp -version -o Unknown.s GNU CPP version 3.2 (cpplib) [AL 1.1, MM 40] SGI running IRIX 6.x GNU C++ version 3.2 (mips-sgi-irix6.5) compiled by GNU C version 3.2. Unknown.cpp: In function `int main()': Unknown.cpp:25: no match for `BlackHole& << <unknown type>' operator When overloading the operator<< for a class other than of type ostream, the compiler is unable to find the type of std::endl. The compiler should be able to find the type of std::endl, since it should be a function pointer. This happens on irix g++3.2, irix g++3.0.4, linux g++3.2, and linux g++3.0.4 (probably all 3.0+ compilers). Since I'm not sure the attachment was received correctly, I apologize, but I am sending the bug report again with the file text included here: ////////////////////////////////////////////////////// #include <iostream> //#define endl endl<char,std::char_traits<char> > class BlackHole{}; template <typename T> BlackHole& operator<<(BlackHole& bh, const T& dummy) { return bh; } template <typename T> BlackHole& operator<<(BlackHole& bh, T& (*dummy)(T&)) { return bh; } int main() { BlackHole bh; std::cout << "hi" << std::endl; std::endl(std::cout); bh << std::endl; return 0; } ////////////////////////////////////////////////////// >How-To-Repeat: Compile the file using g++. >Fix: instead of using std::endl, use std::endl<char,char_traits<char> > or #define endl endl<char,std::char_traits<char> > Should I really have to do this? This seems really wordy and a waste of time. I would really appreciate it if someone let me know a better way to do this. Thanks, -Jason >Release-Note: >Audit-Trail: >Unformatted: ----gnatsweb-attachment---- Content-Type: application/octet-stream; name="Unknown.cpp" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="Unknown.cpp" I2luY2x1ZGUgPGlvc3RyZWFtPgoKLy8jZGVmaW5lIGVuZGwgZW5kbDxjaGFyLHN0ZDo6Y2hhcl90 cmFpdHM8Y2hhcj4gPgoKY2xhc3MgQmxhY2tIb2xle307Cgp0ZW1wbGF0ZSA8dHlwZW5hbWUgVD4K QmxhY2tIb2xlJiBvcGVyYXRvcjw8KEJsYWNrSG9sZSYgYmgsIGNvbnN0IFQmIGR1bW15KQp7CiAg cmV0dXJuIGJoOwp9Cgp0ZW1wbGF0ZSA8dHlwZW5hbWUgVD4KQmxhY2tIb2xlJiBvcGVyYXRvcjw8 KEJsYWNrSG9sZSYgYmgsIFQmICgqZHVtbXkpKFQmKSkKewogIHJldHVybiBiaDsKfQoKaW50IG1h aW4oKQp7CiAgQmxhY2tIb2xlIGJoOwoKICBzdGQ6OmNvdXQgPDwgImhpIiA8PCBzdGQ6OmVuZGw7 CiAgc3RkOjplbmRsKHN0ZDo6Y291dCk7CgogIGJoIDw8IHN0ZDo6ZW5kbDsgIAogIAogIHJldHVy biAwOwp9Cg==
next reply other threads:[~2002-11-13 21:36 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2002-11-20 4:46 jstanek [this message] 2002-11-21 4:17 bangerth 2002-11-21 6:26 Jason Stanek 2002-11-21 7:18 Wolfgang Bangerth 2003-05-10 17:46 Dave Brondsema
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20021113213117.27634.qmail@sources.redhat.com \ --to=jstanek@vrac.iastate.edu \ --cc=gcc-gnats@gcc.gnu.org \ --cc=jstanek@iastate.edu \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).