I have a library code I'm working with. It compiles and works in Visual Studio (2008), but not GCC (v4.8.4.)
In the header we have:
extern const char menu_styles[MENU_COUNT][MAX_LEN];
typedef SysEnum <s_type_t, c_long, no_style, un_style, MAX_LEN, (char *)&menu_styles> MenuStyleEnum;
Where is SysEnum (defined in another file):
template<class ETYPE, class BTYPE, int MINV, int MAXV, int MLEN, char* pStr> class SysEnum
And gcc borks with an error:
error: βmenu_stylesβ cannot appear in a constant-expression
With which I completely agree. (Also, he's const char *distinguished by char *).
I expect VS2008 to just compile this typedef with const char *instead menu_styles, but I'm really not sure.
I fear that VisualSudio is adding some kind of constructor code so that this one char *actually points menu_styleswhenever this typedef is used.
What can I change when compiling with GCC?