From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29241 invoked by alias); 13 Nov 2002 21:36:01 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 29221 invoked by uid 71); 13 Nov 2002 21:36:01 -0000 Resent-Date: 13 Nov 2002 21:36:01 -0000 Resent-Message-ID: <20021113213601.29220.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org, jstanek@iastate.edu Resent-Reply-To: gcc-gnats@gcc.gnu.org, jstanek@vrac.iastate.edu Received: (qmail 27635 invoked by uid 61); 13 Nov 2002 21:31:17 -0000 Message-Id: <20021113213117.27634.qmail@sources.redhat.com> Date: Wed, 20 Nov 2002 04:46:00 -0000 From: jstanek@vrac.iastate.edu Reply-To: jstanek@vrac.iastate.edu To: gcc-gnats@gcc.gnu.org Cc: jstanek@iastate.edu X-Send-Pr-Version: gnatsweb-2.9.3 (1.1.1.1.2.31) X-GNATS-Notify: jstanek@iastate.edu Subject: c++/8567: std::endl is of unknown type when overloading operator<< (repeat in case attachment didnt work) X-SW-Source: 2002-11/txt/msg00632.txt.bz2 List-Id: >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& << ' 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& << ' 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 //#define endl endl > class BlackHole{}; template BlackHole& operator<<(BlackHole& bh, const T& dummy) { return bh; } template 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 > or #define endl endl > 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==