From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28560 invoked by alias); 14 Dec 2005 19:16:19 -0000 Received: (qmail 28520 invoked by uid 48); 14 Dec 2005 19:16:15 -0000 Date: Wed, 14 Dec 2005 19:16:00 -0000 Message-ID: <20051214191615.28519.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug c++/9925] ostrstream (buf, size) << "..." does not work properly In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "aburger at cea dot fr" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2005-12/txt/msg01489.txt.bz2 List-Id: ------- Comment #18 from aburger at cea dot fr 2005-12-14 19:16 ------- This does not compile, and it is much simpler than ostr(ing)stream: class A { public: int a; A() : a(0) {} A& operator<<(int aa) { return *this; } }; A& operator<<(A& thys, A& (*f)(A&)) { return f(thys); } A& tic(A& a) { return a; } int main() { A() << 12 << tic; // ok A a; a << tic << 12; // ok //A() << tic << 12; // does not compile: #if 0 err.cxx:28: invalid conversion from 'A&(*)(A&)' to 'int' err.cxx:28: initializing argument 1 of 'A& A::operator<<(int)' #endif } #if 0 Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2.3/specs Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --host=i386-redhat-linux Thread model: posix gcc version 3.2.3 20030502 (Red Hat Linux 3.2.3-53) #endif -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=9925