From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23132 invoked by alias); 26 Jun 2006 09:57:54 -0000 Received: (qmail 23122 invoked by uid 22791); 26 Jun 2006 09:57:53 -0000 X-Spam-Check-By: sourceware.org Received: from smtp2.belwue.de (HELO smtp2.BelWue.DE) (129.143.2.15) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 26 Jun 2006 09:57:50 +0000 Received: from scmx.science-computing.de (blackhole.science-computing.de [193.197.16.3]) by smtp2.BelWue.DE with ESMTP id k5Q9vkbk028397 for ; Mon, 26 Jun 2006 11:57:47 +0200 (MEST) env-from (M.Froehlich@science-computing.de) Received: from localhost (localhost [127.0.0.1]) by scmx.science-computing.de (Postfix) with ESMTP id E258A18055C0 for ; Mon, 26 Jun 2006 11:57:45 +0200 (CEST) Received: from scmx.science-computing.de ([127.0.0.1]) by localhost (guinesstest [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 18173-08 for ; Mon, 26 Jun 2006 11:57:42 +0200 (CEST) Received: from kuma.science-computing.de (kuma.science-computing.de [10.0.3.115]) by scmx.science-computing.de (Postfix) with ESMTP id A9A7618055C2 for ; Mon, 26 Jun 2006 11:57:42 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by kuma.science-computing.de (Postfix) with ESMTP id 9396142B0E6E for ; Mon, 26 Jun 2006 11:57:42 +0200 (CEST) From: Mathias Froehlich To: gcc-help@gcc.gnu.org Subject: Problem with private copy constructor Date: Mon, 26 Jun 2006 09:57:00 -0000 User-Agent: KMail/1.8 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200606261157.42075.M.Froehlich@science-computing.de> Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2006-06/txt/msg00222.txt.bz2 Hi, I have a problem with that following code together with gcc-4.1.1. #include class base { public: base() { std::cout << __PRETTY_FUNCTION__ << " " << this << std::endl; } private: base(const base&); }; class derived : public base { public: derived() { std::cout << __PRETTY_FUNCTION__ << " " << this << std::endl; } }; void fuu(const base& b) { } int main() { fuu(derived()); return 17; } gcc bails out with the following error message: gcctest2.cpp: In copy constructor 'derived::derived(const derived&)': gcctest2.cpp:8: error: 'base::base(const base&)' is private gcctest2.cpp:11: error: within this context gcctest2.cpp: In function 'int main()': gcctest2.cpp:23: note: synthesized method 'derived::derived(const derived&)= '=20 first required here=20 >From my understanding of c++, I would not expect that this copy constructo= r is=20 called in this case. In fact, gcc-3.3.4 and various other UNIX c++ compiler= s=20 do not need that copy constructor either. Do I need to dig out my copy of the C++ standard or is it something to file= a=20 bugreport? Greetings Mathias --=20 Dr. Mathias Fr=F6hlich, science + computing ag, Software Solutions Hagellocher Weg 71-75, D-72070 Tuebingen, Germany Phone: +49 7071 9457-268, Fax: +49 7071 9457-511