This is the mail archive of the gcc-help@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]
Other format: [Raw text]

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);


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