Subject: toolchain/22455: ostream << long long not defined with gcc3
To: None <gnats-bugs@gnats.netbsd.org>
From: None <stephen@degler.net>
List: netbsd-bugs
Date: 08/12/2003 10:59:35
>Number:         22455
>Category:       toolchain
>Synopsis:       ostream << long long does not get defined with gcc3
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    toolchain-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Aug 12 15:00:06 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Stephen Degler
>Release:        NetBSD 1.6W
>Organization:
	
>Environment:
	
	
System: NetBSD stand.degler.net 1.6W NetBSD 1.6W (STAND) #6: Sun Aug 3 00:21:07 EDT 2003 root@stand.degler.net:/vol1/NetBSD/kernels/STAND alpha
Architecture: alpha
Machine: alpha
>Description:
	ostream and istream operators on long long types are only defined
	if _GLIBCPP_USE_LONG_LONG is defined.  NetBSD does not define it so
	we lose.
	
>How-To-Repeat:
	this is foo.cc:
#include <iostream>

int main (int argc, char **argv)
{
        long long t;
        t = 5;
        std::cout << t;
}

This is the output of "make foo.cc"

% make foo
c++ -O2   -Werror       -o foo foo.cc
foo.cc: In function `int main(int, char**)':
foo.cc:7: error: ambiguous overload for 'operator<<' in 'std::cout << t'
/usr/include/g++/bits/ostream.tcc:63: error: candidates are:
   std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT,
   _Traits>::operator<<(std::basic_ostream<_CharT,
   _Traits>&(*)(std::basic_ostream<_CharT, _Traits>&)) [with _CharT = char,
   _Traits = std::char_traits<char>] <near match>
/usr/include/g++/bits/ostream.tcc:85: error:
   std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT,
   _Traits>::operator<<(std::basic_ios<_CharT,
   _Traits>&(*)(std::basic_ios<_CharT, _Traits>&)) [with _CharT = char, _Traits
   = std::char_traits<char>] <near match>
/usr/include/g++/bits/ostream.tcc:107: error:
   std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT,
   _Traits>::operator<<(std::ios_base&(*)(std::ios_base&)) [with _CharT = char,
   _Traits = std::char_traits<char>] <near match>
/usr/include/g++/bits/ostream.tcc:179: error:
   std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT,
   _Traits>::operator<<(long int) [with _CharT = char, _Traits =
   std::char_traits<char>]
/usr/include/g++/bits/ostream.tcc:216: error:
   std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT,
   _Traits>::operator<<(long unsigned int) [with _CharT = char, _Traits =
   std::char_traits<char>]
/usr/include/g++/bits/ostream.tcc:154: error:
   std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT,
   _Traits>::operator<<(bool) [with _CharT = char, _Traits =
   std::char_traits<char>]
/usr/include/g++/ostream:178: error:                 std::basic_ostream<_CharT,
   _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with
   _CharT = char, _Traits = std::char_traits<char>]
/usr/include/g++/ostream:189: error:                 std::basic_ostream<_CharT,
   _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned
   int) [with _CharT = char, _Traits = std::char_traits<char>]
/usr/include/g++/ostream:193: error:                 std::basic_ostream<_CharT,
   _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT
   = char, _Traits = std::char_traits<char>]
/usr/include/g++/ostream:204: error:                 std::basic_ostream<_CharT,
   _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int)
   [with _CharT = char, _Traits = std::char_traits<char>]
/usr/include/g++/bits/ostream.tcc:306: error:
   std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT,
   _Traits>::operator<<(double) [with _CharT = char, _Traits =
   std::char_traits<char>]
/usr/include/g++/ostream:219: error:                 std::basic_ostream<_CharT,
   _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(float) [with
   _CharT = char, _Traits = std::char_traits<char>]
/usr/include/g++/bits/ostream.tcc:331: error:
   std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT,
   _Traits>::operator<<(long double) [with _CharT = char, _Traits =
   std::char_traits<char>]
/usr/include/g++/bits/ostream.tcc:356: error:
   std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT,
   _Traits>::operator<<(const void*) [with _CharT = char, _Traits =
   std::char_traits<char>] <near match>
/usr/include/g++/bits/ostream.tcc:128: error:
   std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT,
   _Traits>::operator<<(std::basic_streambuf<_CharT, _Traits>*) [with _CharT =
   char, _Traits = std::char_traits<char>] <near match>
/usr/include/g++/ostream:491: error:                 std::basic_ostream<char,
   _Traits>& std::operator<<(std::basic_ostream<char, _Traits>&, const unsigned
   char*) [with _Traits = std::char_traits<char>] <near match>
/usr/include/g++/ostream:486: error:                 std::basic_ostream<char,
   _Traits>& std::operator<<(std::basic_ostream<char, _Traits>&, const signed
   char*) [with _Traits = std::char_traits<char>] <near match>
/usr/include/g++/bits/ostream.tcc:630: error:
   std::basic_ostream<char, _Traits>& std::operator<<(std::basic_ostream<char,
   _Traits>&, const char*) [with _Traits = std::char_traits<char>] <near match>
/usr/include/g++/bits/ostream.tcc:580: error:
   std::basic_ostream<_CharT, _Traits>&
   std::operator<<(std::basic_ostream<_CharT, _Traits>&, const char*) [with
   _CharT = char, _Traits = std::char_traits<char>] <near match>
/usr/include/g++/ostream:452: error:                 std::basic_ostream<char,
   _Traits>& std::operator<<(std::basic_ostream<char, _Traits>&, unsigned char)
   [with _Traits = std::char_traits<char>]
/usr/include/g++/ostream:447: error:                 std::basic_ostream<char,
   _Traits>& std::operator<<(std::basic_ostream<char, _Traits>&, signed char)
   [with _Traits = std::char_traits<char>]
/usr/include/g++/bits/ostream.tcc:508: error:
   std::basic_ostream<char, _Traits>& std::operator<<(std::basic_ostream<char,
   _Traits>&, char) [with _Traits = std::char_traits<char>]
/usr/include/g++/ostream:436: error:                 std::basic_ostream<_CharT,
   _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, char) [with
   _CharT = char, _Traits = std::char_traits<char>]
*** Error code 1


>Fix:
The symbol _GLIBCPP_USE_LONG_LONG could be defined for hosts
that support the long long type, or NetBSD can just remove the
conditional compilation, and include the templates if the host system
supports the long long type.

>Release-Note:
>Audit-Trail:
>Unformatted: