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

Unimplemented core issue 475: std::uncaught_exception is not true when constructing the thrown object

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Medium Medium
    • Code Generation Tools
    • CODEGEN-4090
    • 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
    • Hide
      In the code below, std::uncaught_exception should be true when constructing the A object that is constructed to be propagated to the catch block. The current implementation returns false.

      #include <exception>
      #include <assert.h>

      struct A {
          int i;
          A() : i(0) {}
          A(const A&) : i(std::uncaught_exception() ? 5 : 0) {}
          ~A() { }
      };

      int main()
      {
          try {
              A a;
              assert(a.i == 0);
              throw a;
          } catch (A a) {
              assert(a.i == 5); // Fails
          }
      }
      Show
      In the code below, std::uncaught_exception should be true when constructing the A object that is constructed to be propagated to the catch block. The current implementation returns false. #include <exception> #include <assert.h> struct A {     int i;     A() : i(0) {}     A(const A&) : i(std::uncaught_exception() ? 5 : 0) {}     ~A() { } }; int main() {     try {         A a;         assert(a.i == 0);         throw a;     } catch (A a) {         assert(a.i == 5); // Fails     } }

      Unimplemented core issue 475: std::uncaught_exception is not true when constructing the thrown object

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

              Created:
              Updated: