This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

c++/8566: std::endl is of unknown type when overloading operator<<


>Number:         8566
>Category:       c++
>Synopsis:       std::endl is of unknown type when overloading operator<<
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          support
>Submitter-Id:   net
>Arrival-Date:   Wed Nov 13 13:26: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).

>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==


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]