public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/20681] New: another wrong "control reaches end of non-void function"
@ 2005-03-29  9:55 oliverst at online dot de
  2005-03-29  9:55 ` [Bug c++/20681] another wrong "control reaches end of non-void function" warning oliverst at online dot de
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: oliverst at online dot de @ 2005-03-29  9:55 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2005-09-27 16:09 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-03-29  9:55 [Bug c++/20681] New: another wrong "control reaches end of non-void function" oliverst at online dot de
2005-03-29  9:55 ` [Bug c++/20681] another wrong "control reaches end of non-void function" warning oliverst at online dot de
2005-03-29  9:56 ` oliverst at online dot de
2005-03-29 20:13 ` [Bug c++/20681] [4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
2005-04-05  1:33 ` pinskia at gcc dot gnu dot org
2005-04-08 21:46 ` mmitchel at gcc dot gnu dot org
2005-04-09 16:59 ` fsm at robots dot ox dot ac dot uk
2005-04-21  5:03 ` mmitchel at gcc dot gnu dot org
2005-07-08  1:41 ` mmitchel at gcc dot gnu dot org
2005-08-03  0:37 ` pinskia at gcc dot gnu dot org
2005-08-17 15:56 ` pinskia at gcc dot gnu dot org
2005-08-17 22:34 ` pinskia at gcc dot gnu dot org
2005-08-17 22:47 ` pinskia at gcc dot gnu dot org
2005-09-27 16:10 ` mmitchel at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).