🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by "Bill Mitchell" Wed, 12 Apr 1989 06:52
possible bug in g++-1.34.2 re bogus private constructors
#1858
Author: "Bill Mitchell"
Date: Wed, 12 Apr 1989 06:52
49 lines
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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads