Subject: bin/4490: g++ fails on "cout << hex;"
To: None <>
From: None <>
List: netbsd-bugs
Date: 11/15/1997 00:47:56
>Number:         4490
>Category:       bin
>Synopsis:       g++ does not compile "cout << hex;" correctly
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Nov 14 15:50:01 1997
>Originator:     Ingolf Koch

Ingolf Koch
FSU Jena, Institut fuer Angewandte Mathematik, 07740 Jena
>Release:        NetBSD-current, gnu src of 971113
System: NetBSD 1.3_ALPHA NetBSD 1.3_ALPHA (MAUS) #1: Tue Nov 11 00:24:09 MET 1997 amiga

	g++ does not recognize the dec, hex, ... modifiers for streams
	correctly and emits an "Undefined symbol" error message (see below).
	So you cannot switch the base for integers.
	With 1.2.1 this worked well.

    Maybe this PR should better be in category "lib". I don't know.
% cat
#include <iostream.h>

int main() {
    cout << hex << 42 << dec << 42 << endl;
    return 0;

% g++ -v -o testbase
 /usr/bin/cc -v -o testbase -lg++ -lstdc++ -lm
gcc version
 /usr/libexec/cpp -lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2
	-D__cplusplus -D__GNUC_MINOR__=7 -Dunix -Dm68k -Dmc68000
	-Dmc68020 -D__NetBSD__ -D__KPRINTF_ATTRIBUTE__ -D__unix__
	-D__m68k__ -D__mc68000__ -D__mc68020__ -D__NetBSD__
	-D__KPRINTF_ATTRIBUTE__ -D__unix -D__m68k -D__mc68000
	-D__mc68020 -Asystem(unix) -Asystem(NetBSD) -Acpu(m68k)
	-Amachine(m68k) -D__HAVE_68881__ -D__HAVE_FPU__ /var/tmp/cc02234a.ii
GNU CPP version (68k, MIT syntax)
#include "..." search starts here:
#include <...> search starts here:
End of search list.
 /usr/libexec/cc1plus /var/tmp/cc02234a.ii -quiet -dumpbase
	-version -o /var/tmp/cc02234a.s
GNU C++ version (68k, MIT syntax) compiled by GNU C
 as -o /var/tmp/cc02234a1.o /var/tmp/cc02234a.s
 ld -e start -dc -dp -o testbase /usr/lib/crt0.o -L/usr/libexec
	/var/tmp/cc02234a1.o -lg++ -lstdc++ -lm -lgcc -lc -lgcc

/var/tmp/cc02234a1.o: Undefined symbol `_dec__FR3ios' referenced from
	text segment
/var/tmp/cc02234a1.o: Undefined symbol `_hex__FR3ios' referenced from
	text segment

Note that the "endl" is recognized well.
    No idea.