Article View: gnu.g++.bug
Article #399Type checking in constructors
From: Tom Friedel
Date: Fri, 08 Sep 1989 23:03
Date: Fri, 08 Sep 1989 23:03
51 lines
1525 bytes
1525 bytes
This program was run under 1.35.0 on i386-sysv. I've observed
similar behavior on an early 1.36 beta relase on a Sun/4, but
have not run this exact program.
The comments should indicate where I feel that the compiler
should at least print warnings.
//-------------------------------------------------
class A {
public:
int a ;
A() { } ;
};
class B {
public:
int b,c;
B() { } ;
B( A& ) { } ;
};
main () {
A y ;
B z( y ) ; // OK
B w( z ) ; // perhaps OK (default constructor)
A r( z ) ; // no warning.
B v( (char *) "HI" ) ; // I would hope for at least a warning.
B u( 1 ) ; // again no warning
A t( 1 ); // again no warning
// A s( 1, 2, 3 ); This does generate an error.
}
Tom Friedel
Tom Friedel (404) 320-7624 tpf@jdyx.UUCP
also: tpf@jdyx.atlanta.ga.us ...gatech!emory!jdyx!tpf
Public Access Unix BBS: (404) 321-5020
"Live simply, so that others may simply live."
--
Tom Friedel (404) 320-7624 tpf@jdyx.UUCP
also: tpf@jdyx.atlanta.ga.us ...gatech!emory!jdyx!tpf
Public Access Unix BBS: (404) 321-5020
"Live simply, so that others may simply live."
Technical Details
Message-ID:
<1989Sep8.230344.22320@jdyx.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!iuvax!cica!ctrsol!emory!jdyx!tpfShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!iuvax!cica!ctrsol!emory!jdyx!tpf From: tpf@jdyx.UUCP (Tom Friedel) Newsgroups: gnu.g++.bug Subject: Type checking in constructors Message-ID: <1989Sep8.230344.22320@jdyx.UUCP> Date: 8 Sep 89 23:03:44 GMT Distribution: usa Organization: JDyx Enterprises (Atlanta GA) Lines: 51