On Tue, May 05, 2015 at 09:00:59AM +0100, Renato Golin wrote: > On 5 May 2015 at 05:58, Andrew Pinski <pins...@gmail.com> wrote: > > These two are bogus and really clang in GCC's mind. The main reason > > is the standard says struct and class are the same thing. > > Apart from the fact that classes are private by default and structs > are not. They may be similar for layout purposes, and it may be ok to > interchange them on local re-declarations when the compiler doesn't > need the type completely defined, but they're not the same thing. > > The compiler might be smart and use the protection model that the > original declaration used (private/public), but what that warning is > saying is that you have refactored your code to include classes and > forgot to update all uses, which is a very valid warning. I can't see > why one would *want* to keep the "struct" keyword. If you're already > compiling in C++ mode, removing it from variable/argument declarations > should be valid, and re-declaring incomplete types should be made as > class.
Saying forward declaration should be done with class is a value choice you've made. Given forward declarations with struct and class are interchangable it seems like a perfectly valid choice to me to decide you don't care to bother fix up all the forward declaration when you change from class to struct. The warning is useful for people who care about MSVC compat, or really care about consistancy I guess, but it seems to me since the code it warns about isn't "wrong" in any real way the warning doesn't deserve to be in -Wall or really even in -Wextra. Trev > > cheers, > --renato