From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16242 invoked by alias); 21 Oct 2002 16:06: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 16228 invoked by uid 71); 21 Oct 2002 16:06:01 -0000 Date: Mon, 21 Oct 2002 09:06:00 -0000 Message-ID: <20021021160601.16227.qmail@sources.redhat.com> To: paolo@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, From: Wolfgang Bangerth Subject: Re: c++/8279: REGRESSION: failure to find a matching function in ostream_iterator expansion Reply-To: Wolfgang Bangerth X-SW-Source: 2002-10/txt/msg00778.txt.bz2 List-Id: The following reply was made to PR c++/8279; it has been noted by GNATS. From: Wolfgang Bangerth To: gcc-bugs@gcc.gnu.org, , , Cc: Subject: Re: c++/8279: REGRESSION: failure to find a matching function in ostream_iterator expansion Date: Mon, 21 Oct 2002 11:04:09 -0500 (CDT) The testcase fails for a relatively simple reason: copying to an ostream_iterator invokes ostream_iterator::operator=, which here looks like this: ostream_iterator& operator=(const _Tp& __value) { *_M_stream << __value; //... return *this; } _M_stream is of type std::ostream, and __value of type _Tp=std::pair. So the compiler looks for an operator std::ostream << std::pair Since the declaration of this class is in namespace std, in looks for this operator in namespace std. Since both types are in namespace std, Koenig lookup also does not bring in additional namespaces. It will thus not find the globally declared operator of the test case. This also explains, why it is not compilable with icc6, as well as that it compiled with gcc2.95, since that did not know about namespace std. I don't think there is a simple solution to work around this, short of putting the respective operator in namespace std. At least, I believe the compiler is right to reject the code, and that this is not a bug. Regards Wolfgang ------------------------------------------------------------------------- Wolfgang Bangerth email: bangerth@ticam.utexas.edu www: http://www.ticam.utexas.edu/~bangerth