https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62185
Bug ID: 62185
Summary: New warning for "defined as a struct here but
previously declared as a class" / [-Wmismatched-tags]
Product: gcc
Version: 5.0
Status: UNCONFIRMED
Keywords: diagnostic
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: burnus at gcc dot gnu.org
I am not really sure whether it's worthwhile, but browsing through the warnings
for our code, I found the following one by Clang, which GCC doesn't seem to
have:
foo.cc:5:1: warning: 'foo' defined as a struct here but previously declared as
a class [-Wmismatched-tags]
struct foo {
^
foo.cc:2:1: note: did you mean struct here?
class foo;
^~~~~
struct
Clang emits this warning with -Wall.
Test case:
// Assume some forward declaration in a header file
class foo;
// Assume a C file, #including the header file
struct foo {
int a;
};