This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: template-constructor


>    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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]