On Wed, 2010-11-24 at 15:14 -0800, Roland McGrath wrote:
We spoke on IRC about the details and I think we're clear on the
nit
cleanups I wanted to see before you commit/merge all this, but I'll reply
here anyway just for academic trivia.
I cleaned up/split and rebased the commits as we discussed and pushed to
the dwarf branch.
> - std::pair<_T1, _T2>::second has incomplete type. This
is strange. I
> haven't been able to reproduce it in a smaller setup. The error looks
> as follows:
>
> /usr/lib/gcc/x86_64-redhat-linux/4.5.1/../../../../include/c
> ++/4.5.1/bits/stl_pair.h: In instantiation of std::pair<const
> elfutils::dwarf_output::debug_info_entry,
> elfutils::dwarf_output::die_info> :
> /home/mark/src/elfutils/libdw/c++/dwarf_output:233:63: instantiated
> from here
> /usr/lib/gcc/x86_64-redhat-linux/4.5.1/../../../../include/c
> ++/4.5.1/bits/stl_pair.h:77:11: error: std::pair<_T1, _T2>::second has
> incomplete type
> /home/mark/src/elfutils/libdw/c++/dwarf_output:146:12: error: forward
> declaration of struct elfutils::dwarf_output::die_info
>
> Which doesn't make sense to me. The code it complains about is an
> invocation of vector<die_info_pair *>.end(). The following "patch"
makes
> it go away. But I have no idea why, both code constructs seem to not
> actually use the pair directly:
Yeah, it seems odd since the only things being used are pointers.
If it were a simple case of 'struct opaque *' then it would not matter.
I suspect that the issue here is just that we are implicitly requiring
the template instantiations for std::pair<...>, even though the actual
type std::pair<...> is used only in ways that are ordinarily permissible
for undefined types.
Jason explained it to me as: 4.5 corrected arg-dep lookup to include
template args in the list of associated classes. When you say i !=
_base::end(), it needs to look up the != operator, and
argument-dependent lookup for an argument of type
std::vector<std::pair<const debug_info_entry, die_info>*>::iterator
wants to look into pair<const debug_info_entry,die_info>, but it can't
instantiate it because die_info is incomplete.