Uploaded image for project: 'Embedded Software & Tools'
  1. Embedded Software & Tools
  2. EXT_EP-8730

Exception propagating out of noexcept function does not call std::terminate

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Low Low
    • Code Generation Tools
    • CODEGEN-4076
    • Hide
      ARM_18.1.0.LTS
      MSP430_18.1.0.LTS
      C2000_22.6.0.LTS
      MSP430_20.2.0.LTS
      ARM_18.12.0.LTS
      MSP430_21.6.0.LTS
      C2000_21.6.0.LTS
      MSP430_18.12.0.LTS
      ARM_20.2.0.LTS
      Show
      ARM_18.1.0.LTS MSP430_18.1.0.LTS C2000_22.6.0.LTS MSP430_20.2.0.LTS ARM_18.12.0.LTS MSP430_21.6.0.LTS C2000_21.6.0.LTS MSP430_18.12.0.LTS ARM_20.2.0.LTS

      The following code segment does not call std::terminate, as is required by the C++ 11/14 standards (and is undefined behavior in C++ 03).

      This occurs only when symbolic debug information is present in the source (i.e. the option --symdebug:none is not on the command line)

      #include <stdio.h>
      #include <assert.h>

      struct X {
      X()

      { printf("Ctor\n"); }

      ~X()

      { printf("Dtor\n"); throw "attempt to exit with exception"; }

      };

      static void bar()

      { X x; throw "ordinary exception"; // Destroy }

      int main() {
      try

      { bar(); }

      catch (const char *s)

      { assert(false); }

      printf("Should have called std::terminate\n");
      assert(false); // Should call terminate
      }

            syncuser TI User
            syncuser TI User
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated: