This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: template-constructor
- To: yeolahim at mail dot ru
- Subject: Re: template-constructor
- From: "Martin v. Loewis" <martin at loewis dot home dot cs dot tu-berlin dot de>
- Date: Thu, 23 Mar 2000 22:33:01 +0100
- CC: gcc-bugs at gcc dot gnu dot org
- References: <38DA7F06.B42AE48D@mail.ru>
> please reply me (if bug) to yeolahim@mail.ru(or public it)
> if not, can too ;)
Thanks for your bug report. This is not a bug in the compiler, it is a
bug in your code.
> in run_time
> is : with <iostream> for check of break point at run time
I get a segmentation violation in this example, which is cause by a
double-delete for the same pointer. The reason is that your Array
template does not have a copy constructor. You may think the template
constructor could be used as a copy constructor; however, a template
constructor is *never* a copy constructor - you need an additional,
non-template copy constructor.
> in only_code
> only code
This produces a lot of error messages with the first one being
In file included from test.2.cc:1:
array.2.hh:5: syntax error before `;'
That is no surprise: size_t is not defined. You need to include
<stdlib.h> before that.
Regards,
Martin