Missing constructor call...

Mike Harrold mharrold@cas.org
Mon Jul 15 17:27:00 GMT 2002


Hi,

I'm wondering if anyone knows of an existing bug report
for something I have run into.

If I have a class representing iterators, then under
certain circumstances:

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

results in no copy constructor being called either.
In all cases compiling without optimisation, or with
-O2 results in the same behaviour.

My gcc version is:

Reading specs from /usr/local/gcc-3.0.2/lib/gcc-lib/i686-pc-linux-gnu/3.0.2/specs
Configured with: ../configure --prefix=/usr/local/gcc-3.0.2 --enable-shared --enable-threads --enable-languages=c,c++,java
Thread model: posix
gcc version 3.0.2

If this (or something similar) is known, I wont file a bug report.
If it isn't (and it still occurs in 3.0.4, which I am downloading
right now), I will go ahead. I can't use 3.1 for now as it will
require some work to fix my code, but if this is a known problem
that is fixed in 3.1 let me know and I'll put aside some time for
a code conversion.

Thanks for your time,

/Mike



More information about the Gcc-help mailing list