← Back to team overview

kicad-developers team mailing list archive

Re: I really *love* STL error messages


On Sat, Mar 24, 2012 at 08:43:53AM +0100, Lorenzo Marcantonio wrote:
> I'll look into it. 4.6 gave me 'trouble' even with other stuff (not its fault: it's only more strict). In fact the '-fpermissive' option probably can be used to turn the error in a warning.

It is actually pretty easy...

The declaration

   WX_DECLARE_HASH_MAP(char*, EDA_RECT, wxStringHash, wxStringEqual, RECT_MAP );

makes a typedef (I thing) for map from a char* to an EDA_RECT; then when you do:

   const char* classname = typeid(*this).name();

// ...

   EDA_RECT r = class_map[ classname ];

... you're passing a const char* to a function accepting a char*, which
is not allowed (it can do evil things on the contents, for example; you
also can overload or specialize on const specifiers!)

The solution is simply to use...

WX_DECLARE_HASH_MAP(const char*, EDA_RECT, wxStringHash, wxStringEqual, RECT_MAP );

Lorenzo Marcantonio
Logos Srl

Follow ups