http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46158

           Summary: Spurious never executed warning
           Product: gcc
           Version: 4.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: w...@alum.mit.edu


// test.cpp

#define testIt(expression)                        \
{                                    \
  if (expression) {                            \
      throw true;                            \
  }                                    \
}

void
useIt()
{
  bool eof = false;

  testIt(eof)
}

// End of test.cpp

--------------------------------------------

gcc --version; gcc -Werror -Wunreachable-code -o test.o test.cpp

--------------------------------------------

gcc (GCC) 4.2.1 20070719  [FreeBSD]
Copyright (C) 2007 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.

cc1plus: warnings being treated as errors
test.cpp: In function 'void useIt()':
test.cpp:15: warning: will never be executed

Reply via email to