Open GoogleCodeExporter opened 9 years ago
Don't know whether this is related, but might also happen with member functions
of template classes:
error: member access into incomplete type
Example, a member function is defined in a header file:
//headerfile
namespace somenamespace
{
template <class T> //don't know if this only happens for template classes
class Store : public StoreBase
{
public:
void write (ESM::ESMWriter& writer) const
{
writer.startRecord (T::sRecordId);
}
}
}
iwyu says i should add
namespace ESM { class ESMWriter; }
and should remove:
#include <components/esm/esmwriter.hpp> // lines 10-10
which then would cause
error: member access into incomplete type
(full example file here:
https://github.com/OpenMW/openmw/blob/master/apps/openmw/mwworld/store.hpp)
Original comment by showard...@gmail.com
on 7 Feb 2015 at 5:58
Thanks for the bug report, showard314. I was able to reproduce it with
`std::vector<std::pair<int, IndirectClass> >`. By the way, just `std::pair<int,
IndirectClass>` requires full use of IndirectClass. My current guess is that we
correctly detect we need full use of std::pair, but we don't check full use,
forward-declare use for std::pair template arguments.
Original comment by vsap...@gmail.com
on 10 Feb 2015 at 3:21
I just came across this same bug*, but I'd just like to note that when the
class has both vector<pair<string,string>> and plain string member variables,
it still recommends to use iosfwd instead of string. Is there any known
workaround for this?
Original comment by douwegel...@gmail.com
on 27 Mar 2015 at 1:25
It's not helpful, but I think the problem with iosfwd is issue #80, especially
if you are using libc++, not libstdc++. And unfortunately I don't know any
workarounds for it.
Original comment by vsap...@gmail.com
on 31 Mar 2015 at 6:10
Original issue reported on code.google.com by
showard...@gmail.com
on 7 Feb 2015 at 5:41