Path: utzoo!telly!ddsw1!mcdchg!rutgers!mailrus!tut.cis.ohio-state.edu!MCC.COM!rfg From: rfg@MCC.COM (Ron Guilmette) Newsgroups: gnu.g++.bug Subject: BUG(s) in G++ 1.32 - inconsistant errors/warnings - missing constructor Message-ID: <8901252028.AA10350@riunite.aca.mcc.com> Date: 25 Jan 89 20:28:40 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 56 The following three files show that G++ (1.32.0) handles the case of a call to an un-declared constructor differently in different contexts. If the call to the undeclared constructor occurs for a static or an auto object, then warnings are issued. If however the constructor call is made for a heap (new) object then an error is issued. I believe that all three cases demand that an error be issued. After all, you are supposed to declare things before you use them right? At the very least, all three cases should be handled the same way. ==================================================================== /* Description - check that a constructor with a given parameter profile cannot be called for a global (static) object unless the constructor has already been explicitly declared. */ struct node { int f1; }; node global_node(7); // ERROR: node(int) not declared ==================================================================== /* Description - check that a constructor with a given parameter profile cannot be called for a local (auto) object unless the constructor has already been explicitly declared. */ struct node { int f1; }; main () { node local_node(9); // ERROR: node(int) not declared } ===================================================================== /* Description - check that a constructor with a given parameter profile cannot be called for a heap (new) object unless the constructor has already been explicitly declared. */ struct node { int f1; }; main () { node& node_ref = new node(9); // ERROR: node(int) not declared } =========================================================================