Bugzilla will be upgraded to version 5.0 on a still to be determined date in the near future. The original upgrade date has been delayed.
Bug 62850 - gcc 3.1-0.23.1 stream inserter lookup fails
gcc 3.1-0.23.1 stream inserter lookup fails
Product: Red Hat Raw Hide
Classification: Retired
Component: gcc3 (Show other bugs)
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
Depends On:
  Show dependency treegraph
Reported: 2002-04-06 02:58 EST by Peter Klotz
Modified: 2008-05-01 11:38 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2002-04-06 02:58:11 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Peter Klotz 2002-04-06 02:58:07 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:0.9.9) Gecko/20020311

Description of problem:
If the line '#define TWO_INSERTERS' is commented out, the program compiles
without warnings (using -W -Wall) and works as expected, namely writing
'manipulator called' two times.
If the program is compiled as is, one obtains a warning during compile         
(which tells us that the compiler does not use the stream inserter we intend to)
and the program writes 'manipulator called' only once.

gcc 2.96/2.95.3 always compiles without warnings and calls the stream
manipulator twice. Also does the Borland Compiler 5.5.1 and Comeau 4.3Beta2.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. g++3 -W -Wall manip.cpp

Actual Results:  During compile:
manip.cpp: In function `void ns::f()':
manip.cpp:28: warning: the address of `void
   ns::manipulator(std::ostringstream&)', will always be `true'

Expected Results:  No warnings and the output 'manipulator called' two times.

Additional info:

#include <iostream>
#include <sstream>


void operator<<(std::ostream& s, void (*f)(std::ostringstream&))

namespace ns {

void manipulator(std::ostringstream&)
    std::cout << "manipulator called" << std::endl;

std::ostream& operator<<(std::ostream& s, int)
	return s;

void f()
    std::ostringstream s;
    s << ns::manipulator;

} // namespace

int main()
    std::ostringstream s;
    s << ns::manipulator;
    return 0;
Comment 1 Jakub Jelinek 2002-04-10 08:45:05 EDT
According to Jason Merrill this is correct.
The big difference between g++ 2.9x and 3.x is honoring of std namespace
which changes things a lot for this testcase.
If you have an inserter in the ns namespace, then standard bool inserter is

Note You need to log in before you can comment on or make changes to this bug.