[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#619130: ERROR: compile in g++-4.5



I have rechecked with g++-4.6

$> g++ --version                                                                                                      
g++-4.6 (Debian 4.6.0-2) 4.6.1 20110329 (prerelease)                                                                                                                               
Copyright (C) 2011 Free Software Foundation, Inc.                                                                                                                                  
This is free software; see the source for copying conditions.  There is NO                                                                                                         
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


I have got the same error:
$> g++ compileError.cxx
In file included from /usr/include/c++/4.6/bits/stl_algobase.h:65:0,                                                                                                               
                 from /usr/include/c++/4.6/bits/stl_tree.h:63,                                                                                                                     
                 from /usr/include/c++/4.6/map:60,                                                                                                                                 
                 from compileError.hxx:1,                                                                                                                                          
                 from compileError.cxx:1:                                                                                                                                          
/usr/include/c++/4.6/bits/stl_pair.h: In instantiation of ‘std::pair<const int, structure>’:                                                                                       
compileError.hxx:11:55:   instantiated from here                                                                                                                                   
/usr/include/c++/4.6/bits/stl_pair.h:93:11: error: ‘std::pair<_T1, _T2>::second’ has incomplete type                                                                               
compileError.hxx:3:8: error: forward declaration of ‘struct structure’


On 04/23/2011 03:41 PM, Matthias Klose wrote:
tag 619130 + moreinfo
thanks

please recheck with g++-4.6, and attach the preprocessed source for 4.6 too, if it still fails to build

thanks, Matthias
#include "compileError.hxx"

int main()
{
    mapOfStructure tmp;
    return 0;
}

#include <map>

struct structure;

typedef std::map<int, structure> mapOfStructure;

class simpleClass
{
    mapOfStructure m_mos;
    const mapOfStructure GetMos () const { return m_mos; }
    void SetMos ( const mapOfStructure& v ) { m_mos = v; }
};

struct structure
{
    int i;
};


Reply to: