This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/36032] New: -fno-exceptions breaks simple if-statement.


Consider:

  #include <iostream>

  int main()
  {
    if(true) try {} catch(int) {}
    else std::cout << "bla\n";
  }

When compiled without -fno-exceptions, "bla" is not printed (which is correct).
When compiled /with/ -fno-exceptions, "bla" /is/ printed (which is not
correct).

This appears to be due to the following overly simplistic definitions in
libsupc++/exception_defines.h:

  #ifndef __EXCEPTIONS
  // Iff -fno-exceptions, transform error handling code to work without it.
  # define try      if (true)
  # define catch(X) if (false)


-- 
           Summary: -fno-exceptions breaks simple if-statement.
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: gcc-bugzilla at contacts dot eelis dot net


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]