[Bug c++/48224] ERROR: compile in g++ version 4.5
pinskia at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Mar 21 20:12:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48224
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> 2011-03-21 19:24:26 UTC ---
I think this is correct as structure is incomplete when the instantiation of
std::pair<const int, structure> happens which is in SetMos.
Try:
#include <map>
struct structure;
typedef std::map<int, structure> mapOfStructure;
class simpleClass
{
mapOfStructure m_mos;
const mapOfStructure& GetMos () const { return m_mos; }
inline void SetMos ( const mapOfStructure& v );
};
struct structure
{
int i;
};
inline void simpleClass::SetMos ( const mapOfStructure& v )
{
m_mos = v;
}
--- CUT ---
Which is fixes the problem as pair needs both template arguments to be complete
when SetMos is declared. Note I think it is needed for simpleClass is also
declared really. So moving the declaration of structure before simpleClass is
the correct fix really.
More information about the Gcc-bugs
mailing list