Bug 221550
Summary: | g++ and g++4 output bogus warnings on valid C code bracketed with extern "C" when using -Wshadow | ||
---|---|---|---|
Product: | Red Hat Enterprise Linux 4 | Reporter: | Wagner T. Correa <wtcorrea> |
Component: | gcc3 | Assignee: | Jakub Jelinek <jakub> |
Status: | CLOSED NOTABUG | QA Contact: | |
Severity: | medium | Docs Contact: | |
Priority: | medium | ||
Version: | 4.4 | ||
Target Milestone: | --- | ||
Target Release: | --- | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | Bug Fix | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2007-01-05 07:53:59 UTC | Type: | --- |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: |
Description
Wagner T. Correa
2007-01-05 01:23:54 UTC
There is nothing wrong on the warning. extern "C" doesn't mean compile this chunk of source with a C compiler, extern "C" is solely about external linkage. And in C++, struct/class names are injected into the same namespace as function names. I still think it's strange to give warnings about perfectly correct C code marked as C code. Plus, if I write this: extern "C" { struct Foo {}; void Foo(void) {} } int main() { Foo a; return 0; } I get an error and a warning on line 8: foo.cpp: In function `void Foo()': foo.cpp:3: warning: `void Foo()' hides constructor for `struct Foo' foo.cpp: In function `int main()': foo.cpp:8: error: expected `;' before "a" foo.cpp:8: warning: statement is a reference, not call, to function `Foo' I get the warning on line 8 even without the -Wshadow option. So, to me the warning on line 3 seems redundant for code affected by it, and unnecessary and strange for code not affected by it. Please reread what I said above and/or the ISO C++98 standard, extern "C" is not marking something as C code. |