------- Comment #1 from pmladek at suse dot cz 2005-12-13 13:08 ------- First, I am sorry for the first empty message. I pressed enter too fast.
Well, I have got an invalid warning: control reaches end of non-void function with gcc-4.1.0-pre The reduced testcase looks like: --- cut --- namespace store { class OStoreFile { public:inline OStoreFile (void) {}; inline ~ OStoreFile (void) {}; }; } using namespace store; int test (int i1, int i2) { OStoreFile rRegFile; if (i2) { switch (i2) { case 1: return 1; break; case 2: return 2; break; default: return 0; break; } } else { if (i2 == 10) return 2; else return 3; } } --- cut --- Here is the output from g++: hope:/tmp/gcc.bug # g++ -c -Wall test.ii test.ii: In function ‘int test(int, int)’: test.ii:37: warning: control reaches end of non-void function hope:/tmp/gcc.bug # g++ --version g++ (GCC) 4.1.0 20051129 (prerelease) (SUSE Linux) Copyright (C) 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. The warning should not be printed because a value is returned in each case. It seems that the variable OStoreFile rRegFile; is important to reproduce the problem. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25390