[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference turris::c_plus_plus

Title:C++
Notice:Read 1.* and use keywords (e.g. SHOW KEY/FULL KIT_CXX_VAX_VMS)
Moderator:DECCXX::AMARTIN
Created:Fri Nov 06 1987
Last Modified:Thu Jun 05 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:3604
Total number of notes:18242

3461.0. "5.5, internal compiler error, nested class used to instantiate template" by KZIN::HUDSON (That's what I think) Mon Feb 24 1997 08:28

The following was sent to me by a software developer.

I've reproduced the problem and can't match it with the other
accvio's reported in the conference (although if it is the same
then please feel free to move this note).

nick

when compiling that tiny C++ program, your DEC cxx 
compiler  fails  with  the following error message:

cxx: Fatal: A memory access violation (bus error or 
segmentation fault)  has occurred.  Please submit a 
problem report.

======================= decbug.cpp ===================
template <class T>
class vector {
	public:
		vector(int n, const T& value = T());
};

class A {
	public:
		class nested {
			public:
				// nested();
				~nested();
		};
};

void main()
{
	vector<A::nested> vec;
}
======================================================


Operating system:
% uname -a => OSF1 macao.ctec-sw.com V4.0 464 alpha

compiler:
% cxx -V
cxx  (cxx)
DEC C++ V5.5-004 on Digital UNIX (Alpha)


Note: When  uncommenting the default constructor `nested()'
the program compiles (but does not link, but thats not the
problem here).

T.RTitleUserPersonal
Name
DateLines
3461.1Definitely a cxx bug, but currently unclear as to whether this should generate a compiler error...DECC::J_WARDMon Feb 24 1997 09:4060
/*
See the even simpler program below.

You've hit a touchy area of the C++ language,
i.e. whether default constructors must be supplied
for arguments used in default template argument 
declarations.

This is currently a hot topic in the ANSI
C++ committee, since most current implementations
of the STL (including ours) heavily rely
on the answer being no. At the last meeting
some wording was added to the library section
which said:

"Throughout the C++ Library clauses (17 through 27)
whenever a template member function is declared with one or
more default arguments, this is to be understood as
specifying a set of two or more overloaded template
member functions. ..."

At the next C++ standards meeting (in a couple of weeks) the
issue of whether the compiler should have to
accept the program below OR whether all the
STL library declarations that face this problem
should have to be changed to a set of overloaded 
declarations, i.e.:
 
// this would have be changed:
vector(int n, const T& value = T()) {;} 
// to:
vector(int n);
vector(int n, const T& value);

For now, cxx obviously should not give an internal error
here. It should either accept the program or give an error 
that the A::nested() ctor declaration is missing. I'm not
sure why there's only a problem if the template argument
has a destructor declaration. But as you can see below,
it has nothing to do with the fact that you're using
a nested type.

In the meantime you can either supply the A::nested ctor 
or break up the vector ctor declaration into a set of 
overloaded declarations as described above.
*/

template <class T>
struct vector {
		vector(int n, const T& value = T()) {;} 
};

class A {
	~A();
};

void main()
{
	vector<A> vec(1);
}
3461.2CXXC::WOLFEWed May 28 1997 10:561
fixed by v6.0