Article View: gnu.g++.bug
Article #1858possible bug in g++-1.34.2 re bogus private constructors
From: "Bill Mitchell"
Date: Wed, 12 Apr 1989 06:52
Date: Wed, 12 Apr 1989 06:52
49 lines
1821 bytes
1821 bytes
The following program either illustrates a bug in g++.1.34.2 or a bug in my
understanding.
---------------------------------
void printf(char *, ...);
class A {
A() {
printf("Creating A\n");
}
};
class B {
A *ap;
B(A *p, int x) {
printf("Creating B\n");
ap = p;
}
};
main()
{
printf("Starting...\n");
A a;
B b(&a, 1);
}
-----------------------------------
When compiled, it produces a couple of warnings:
bug1.cc:7: warning: class A only defines private constructors and has no friends
bug1.cc:15: warning: class B only defines private constructors and has no friends
The code produced for main() has no evidence of the constructors for a and b.
Just on general principles, I would expect further messages rising from the
declarations of a and b when there are no constructors to be used, but perhaps
this is a feature. (???) If the second argument is elided from B::B(), then
"B b(&a)" will draw an error: "bad argument to constructor B".
This is with g++-1.34.2/gcc-1.34 on a Sun-3 running 4.0.1.
p.s.
I think g++/gdb is still the best thing around; keep up the good work!
--------------------------------------------------------------------
Bill Mitchell whm@sunquest.com
Sunquest Information Systems sunquest!whm@arizona.edu
Tucson, AZ {arizona,uunet}!sunquest!whm
602-885-7700
Technical Details
Message-ID:
<8904120652.AA00619@sunquest>Path:
arc1-ca.pugleaf.net!utzoo!telly!attcan!uunet!tut.cis.ohio-state.edu!UUNET.UU.NET!sunquest!whmShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!telly!attcan!uunet!tut.cis.ohio-state.edu!UUNET.UU.NET!sunquest!whm
From: sunquest!whm@UUNET.UU.NET ("Bill Mitchell")
Newsgroups: gnu.g++.bug
Subject: possible bug in g++-1.34.2 re bogus private constructors
Message-ID: <8904120652.AA00619@sunquest>
Date: 12 Apr 89 06:52:08 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 49