From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9924 invoked by alias); 26 Nov 2004 19:10:44 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 9909 invoked from network); 26 Nov 2004 19:10:41 -0000 Received: from unknown (HELO tardis.ee.ethz.ch) (129.132.2.217) by sourceware.org with SMTP; 26 Nov 2004 19:10:41 -0000 Received: from localhost (tranquillity.ee.ethz.ch [129.132.2.222]) by tardis.ee.ethz.ch (Postfix) with ESMTP id 235B1D93A0 for ; Fri, 26 Nov 2004 20:10:41 +0100 (MET) Received: from tardis.ee.ethz.ch ([129.132.2.217]) by localhost (tranquillity [129.132.2.222]) (amavisd-new, port 10024) with LMTP id 00424-02-4 for ; Fri, 26 Nov 2004 20:10:40 +0100 (MET) Received: from maruti.ee.ethz.ch (maruti.ee.ethz.ch [129.132.3.20]) by tardis.ee.ethz.ch (Postfix) with ESMTP id E3EDCD939A for ; Fri, 26 Nov 2004 20:10:40 +0100 (MET) Received: by maruti.ee.ethz.ch (Postfix, from userid 3018) id A88DA2CE56; Fri, 26 Nov 2004 20:10:40 +0100 (MET) Date: Fri, 26 Nov 2004 19:38:00 -0000 From: Peter Cech To: gcc@gcc.gnu.org Subject: Passing temprary by reference requires copy constructor in 3.4? Message-ID: <20041126191040.GD9325@ee.ethz.ch> Mail-Followup-To: Peter Cech , gcc@gcc.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.1i X-Virus-Scanned: by amavisd-new at ee.ethz.ch X-SW-Source: 2004-11/txt/msg01035.txt.bz2 Hi, trying to compile class EventObject { public: EventObject() {} private: EventObject(const EventObject&); }; class AnyEvent : public EventObject { public: AnyEvent() {} private: AnyEvent(const AnyEvent&); }; void invoke(const EventObject &) {} void caller1() { AnyEvent event; invoke(event); } void caller2() { invoke(AnyEvent()); } leads to following error with both gcc (GCC) 3.4.3 (Gentoo Linux 3.4.3, ssp-3.4.3-0, pie-8.7.6.6) and gcc (GCC) 4.0.0 20041121 (experimental) a.cpp: In function `void caller2()': a.cpp:16: error: `AnyEvent::AnyEvent(const AnyEvent&)' is private a.cpp:29: error: within this context Why gcc requires copy constructor in such situation? Regards, Peter Cech