This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/43344] New: -Wunreachable-code incorrect warning
- From: "jiri dot engelthaler at zat dot cz" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 12 Mar 2010 12:26:57 -0000
- Subject: [Bug c++/43344] New: -Wunreachable-code incorrect warning
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
By adding a destructor to main class to example in the bug 21228
(http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21228) will produce incorrect
warning about code that "will never be executed"
# g++ -Wunreachable-code gstest.cpp
gstest.cpp: In constructor ?testString::testString()?:
gstest.cpp:24: warning: will never be executed
gstest.cpp: In constructor ?testString::testString()?:
gstest.cpp:24: warning: will never be executed
#cat gstest.cpp
// #include <stdio.h>
class testStringBase
{
public:
~testStringBase();
char *stringPtr;
};
testStringBase::~testStringBase()
{
stringPtr = 0;
}
class testString : public testStringBase
{
public:
testString();
};
testString::testString()
{
stringPtr = (char *) 9;
}
int main(int argc, char **argv) {
testString s;
// printf("s.stringPtr is %ld\n", (unsigned long) s.stringPtr);
}
--
Summary: -Wunreachable-code incorrect warning
Product: gcc
Version: 4.4.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: jiri dot engelthaler at zat dot cz
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43344