'SR.1419' is used uninitialized in this function...

Jonathan Wakely cow@compsoc.man.ac.uk
Wed Jan 26 14:27:00 GMT 2005


On Tue, Jan 25, 2005 at 12:48:58PM -0800, Benjamin Redelings wrote:

> I now have a 30-line test-case (attatched) which triggers two bugs:
> a) the structure member has a name, but is not named.
> b) the structure member is not actually used, despite the warning.

It's used in the compiler-generated copy constructor, which would be
something like this:

    iterator(const iterator& other) : circuits(other.circuits) {}

and it is called when branchview::my_iterator returns by value.

> Ways to make the problem go away include:
> a) make a function non-virtual
> b) make a function not a template
> c) remove the undefined, and supposedly unused variable.
> d) turn off all optimization.

Or alternatively, initialise the variable in the constructor:

    iterator() : circuits() {}

jon

-- 
Dull but sincere filler



More information about the Gcc mailing list