🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

3 total messages Started by Ron Guilmette Wed, 25 Jan 1989 20:28
BUG(s) in G++ 1.32 - inconsistant errors/warnings - missing constructor
#1652
Author: Ron Guilmette
Date: Wed, 25 Jan 1989 20:28
56 lines
2130 bytes
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
}
=========================================================================
Possible libg++ bug.
#1633
Author: Tony Li
Date: Wed, 25 Jan 1989 23:17
38 lines
1458 bytes
Configuration: g++ 1.32, sun4-os4, libg++ 1.25 compiled with g++ 1.32

The following program generates garbage.  It works fine on Sun 3's.
----------------------------------------------------------------------
#include <stream.h>

class vector {
protected:
	double *v;
	int    sz;
public:
	vector(int size) { sz = size; v = new double [sz]; }
	vector(const vector& vv) { sz = vv.size(); v = new double [sz];
				   for (int i = 0; i < sz; i ++)
					v[i] = vv[i]; }
	~vector() { delete v; }
	double& operator[](int i) { return v[i]; }
	int& size(void) { return sz; }
};

ostream& operator<<(ostream& s, const vector& v) {
        for (int i = 0; i < v.size(); i ++) 
	      s << v[i] << "\t";
	return (s << "\n");
}

main () {

	vector v(3);
	v[0] = 1.0; v[1] = 2.0; v[2] = 3.0;
	
	cout << v;
}
Tony Li - USC University Computing Services - Dain Bramaged.
Uucp: oberon!tli						
Bitnet: tli@kylara, tli@ramoth
Internet: tli@sargas.usc.edu
Re: Possible libg++ bug.
#1634
Author: Doug Schmidt
Date: Thu, 26 Jan 1989 07:16
16 lines
1242 bytes
In article <14924@oberon.USC.EDU> tli@sargas.usc.edu (Tony Li) writes:
++
++Configuration: g++ 1.32, sun4-os4, libg++ 1.25 compiled with g++ 1.32
++
++The following program generates garbage.  It works fine on Sun 3's.
++----------------------------------------------------------------------

This program works fine on my sun 4 with libg++ 1.32.  Perhaps you
should get libg++ 1.32 from prep?  It is quite nice.

Doug
--
schmidt@ics.uci.edu (ARPA) |   Per me si va nella citta' dolente.
office: (714) 856-4043     |   Per me si va nell'eterno dolore.
                           |   Per me si va tra la perduta gente.
                           |   Lasciate ogni speranza o voi ch'entrate.
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