[Bug c++/43344] New: -Wunreachable-code incorrect warning
jiri dot engelthaler at zat dot cz
gcc-bugzilla@gcc.gnu.org
Fri Mar 12 12:27:00 GMT 2010
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
More information about the Gcc-bugs
mailing list