I would like to get GCC to produce a warning that VisualStudio produces when it finds a name that has been declared with both class
and struct
. (Warning 4099) This usually results from forward declarations such as:
struct Base;
...
class Base { ... };
VS actually fails to link in this case so I've promoted the warning to an error. Since this project is cross-platform I would like to also discover this issue when compiling with GCC -- otherwise I can accidentally check in code that won't work in VS.
Is there any switch, or method, to get GCC to also reject, or warn, about such class/struct declaration mismatches?
NOTE: From the comments it is uncertain whether this warning is legitimate. For my question it isn't relevant since the condition causes the linking in VisualStudio to fail (I can't just ignore the warning). Thus I'd just like to identify the problems using GCC so my windows compiles don't suddenly stop working.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…