------- Comment #2 from mckelvey at maskull dot com 2007-05-25 23:03 -------
Here is how I compile it:
/usr/local/bin/g++ -c -O3 -DNDEBUG -Wuninitialized -pedantic-errors -Werror
-Winline -ansi -fno-common -Wall -Wold-style-cast -Wsign-promo -Wpointer-arith
-Wundef -Wwrite-strings -Winvalid-pch -Woverloaded-virtual -Wcast-qual -Wextra
-Wredundant-decls -Wshadow -Wcast-align -Wcomment -fstrict-aliasing
-Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wlogical-op
-Wunused -fvisibility-inlines-hidden -MMD
-fimplicit-templates -o CircularlyReferenceable.o CircularlyReferenceable.cc
"froms" is the multiset. The destructor will be called in the normal case.
There
is an exception, but it is thrown before the multiset is even created.
SeenMultiset froms;
if (from != PDNULL)
{
froms.insert(from);
}
// Record we've been seen
seen_map.insert(std::make_pair(this, froms));
return true;
The warning points at the seen_map.insert and the return.
Whole member function:
bool CircularlyReferenceable::
_accumulate_delete_candidates(
const CircularlyReferenceable * const from,
SeenMap& seen_map) const
{
if (! _is_allocated())
{
if (! get_strict())
{
return false;
}
throw InternalException(_message(_msgtext("Inconsistent reference "
"count: %s(0)::%s(1)"),
name(),
"_accumulate_delete_candidates"),
__FILE__,
__LINE__);
}
// Get our entry (if there is one)
const SeenMap::iterator it(seen_map.find(this));
if (it == seen_map.end())
{
// We haven't been seen before; make an entry
SeenMultiset froms;
if (from != PDNULL)
{
froms.insert(from);
}
// Record we've been seen
seen_map.insert(std::make_pair(this, froms));
return true;
}
// We have been seen before, update the set of pointers to us
if (from != PDNULL)
{
it->second.insert(from);
}
return false;
}
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32089