This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/20681] New: another wrong "control reaches end of non-void function"
- From: "oliverst at online dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 29 Mar 2005 09:55:09 -0000
- Subject: [Bug c++/20681] New: another wrong "control reaches end of non-void function"
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
The following code causes a wrong warning (I couldn't reduce it to less):
#include <set>
using namespace std;
struct CExtendedEmailInfo {
bool _s;
};
struct CMetaBitField {
int _type;
int GetType() const{
return _type;
}
bool operator < (const CMetaBitField&) const {
return true;
}
};
int GetMetaCombination (CExtendedEmailInfo& info)
{
try
{
if (info._s)
{
set<CMetaBitField> _bitfields;
set<CMetaBitField>::iterator bi;
if (bi != _bitfields.end())
{
const CMetaBitField& bf = *bi;
switch (bf.GetType())
{
case 0:
{
return 17;
}
break;
case 1:
{
return 18;
}
break;
default:
// really shouldn't happen, but just in case...
return 0;
}
}
else
{
return 0;
}
}
else
{
return 0;
}
}
catch (...)
{
return -1;
}
}
C:\Dev-Cpp\Projects\test-stlport\main_6.cpp In function 'int
GetMetaCombination(CExtendedEmailInfo&)':
66 C:\Dev-Cpp\Projects\test-stlport\main_6.cpp [Warning] control reaches end of
non-void function
I am using:
Using built-in specs.
Target: i686-pc-mingw32
Configured with: /datal/gcc/gcc/configure --prefix=/datal/gcc/build/wingcc
--build=i686-pc-linux-gnu --host=i686-pc-mingw32 --target=i686-pc-mingw32
--enable-languages=c,c++,java --with-gcc --with-gnu-as --with-gnu-ld
--enable-threads=win32 --disable-nls --disable-win32-registry --disable-shared
--disable-debug --without-newlib --enable-libgcj --disable-java-awt --without-x
--enable-java-gc=boehm --disable-libgcj-debug --enable-interpreter
--enable-hash-synchronization --enable-sjlj-exceptions --enable-libgcj-multifile
--enable-libgcj-mingw-osapi=ansi
Thread model: win32
gcc version 4.0.0 20050324 (prerelease)
--
Summary: another wrong "control reaches end of non-void function"
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: oliverst at online dot de
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20681