This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Missing constructor call...
- From: Mike Harrold <mharrold at cas dot org>
- To: kisa at centropolisfx dot com
- Cc: mharrold at cas dot org (Mike Harrold), gcc-help at gcc dot gnu dot org
- Date: Mon, 15 Jul 2002 21:54:59 -0400 (EDT)
- Subject: Re: Missing constructor call...
>
>
> > If I have a class representing iterators, then under
> > certain circumstances:
>
> Is there anyway you can describe a bit more these certain circumstances
> to determine whether this is really a bug in your code or in the gcc? It
> is really suspicious that this is working in some instances and not in
> others...
>
> Thanks,
> Gokhan
Sorry, I should have been a little more specific. The certain
circumstances are somewhat unknown. What I do know is that I
have not yet been able to create a small testcase that shows
the problem. I also know that in some situations with the same
code usage, albeit in a different place, that the correct
behaviour occurs.
When iterating through a list, I use the following style:
const class::const_iterator start = list.begin();
const class::const_iterator finish = list.end();
for (class::const_iterator iter = start; iter != finish; ++iter)
...
This is how I initially discovered the problem. I resolved it
down to the construction/initialisation problem by testing
various things.
If I can construct a small testcase I'll post it (assuming that
the problem is not fixed in 3.0.4 which I am compiling now).
/Mike
> > const C::const_iterator start = my_list.begin();
> > C::const_iterator iter = start;
> >
> > will result in no constructor being called for iter,
> > Whereas:
> >
> > const C::const_iterator start = my_list.begin();
> > C::const_iterator iter;
> > iter = start;
> >
> > results in the correct code. Also:
> >
> > const C::const_iterator start = my_list.begin();
> > C::const_iterator iter(start);