Article View: gnu.g++.bug
Article #28Compiler generated copy constructor bug
From: Stephane Chatty
Date: Tue, 03 Nov 1992 11:49
Date: Tue, 03 Nov 1992 11:49
31 lines
991 bytes
991 bytes
// g++ 2.3.1 still has problems with compiler-generated copy constructors.
// In the following code, g++ prefers calling C::operator int() and C::C(int)
// rather than generating C::C(const C&) and calling it.
#include <stdio.h>
class C {
public:
C (int) { printf ("C (int)\n"); }
operator int () { return 0; }
};
main ()
{
C c1 (1);
C c2 (c1);
}
/* Expected output:
C (int)
*/
/* Output obtained with g++ 2.3.1:
C (int)
C (int)
*/
Technical Details
Message-ID:
<9211030949.AA01665@geant.cenatls.cena.dgac.fr>Path:
arc1-ca.pugleaf.net!sparky!uunet!ogicse!hp-cv!sdd.hp.com!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!geant.cenatls.cena.dgac.fr!chattyShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!ogicse!hp-cv!sdd.hp.com!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!geant.cenatls.cena.dgac.fr!chatty From: chatty@geant.cenatls.cena.dgac.fr (Stephane Chatty) Newsgroups: gnu.g++.bug Subject: Compiler generated copy constructor bug Message-ID: <9211030949.AA01665@geant.cenatls.cena.dgac.fr> Date: 3 Nov 92 11:49:31 GMT Article-I.D.: geant.9211030949.AA01665 Sender: gnulists@ai.mit.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 31 Approved: bug-g++@prep.ai.mit.edu