🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by David Detlefs Mon, 14 Aug 1989 21:53
no error message when non-existent constructor is called.
#347
Author: David Detlefs
Date: Mon, 14 Aug 1989 21:53
32 lines
1040 bytes
Michael et. al. --

G++ 1.35.0 on a uvax3.

Consider the following program:

--------------------------------------------------
#include <stream.h>

struct foo {
 public:
  foo();
 private:
  int i;
};

foo::foo() { cout << "Hello.\n"; }

void main() {
  foo f(7);
}
--------------------------------------------------

This should give an error message, because there is no "foo"
constructor that takes an integer argument.  Instead if gives no
argument.  Even more insidious, it does not call the default
constructor -- when run, the above program prints nothing.

Thanks.  Ad astra.

Dave
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