[Bug c++/48224] ERROR: compile in g++ version 4.5

evgenij.fokin at gmail dot com gcc-bugzilla@gcc.gnu.org
Tue Mar 22 10:02:00 GMT 2011


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48224

Evgenij <evgenij.fokin at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|INVALID                     |

--- Comment #3 from Evgenij <evgenij.fokin at gmail dot com> 2011-03-22 09:38:34 UTC ---
Andrew, your code works fine. But this example can show another problem.

Remove setter from code and change return type for getter.

#include <map>

struct structure;

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

class simpleClass
{
    mapOfStructure m_mos;
    const mapOfStructure GetMos () const { return m_mos; }
};

struct structure
{
    int i;
};

--- CUT ---
Getter returns incomplete type but no compile error.
Why the getter compiles without error and the setter compiles with error?



More information about the Gcc-bugs mailing list