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

Unimplemented core issue 1769: Catching a thrown derived class by reference to base clas

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Medium Medium
    • Code Generation Tools
    • CODEGEN-4072
    • 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
      Core 1769, involving a resolution which states that derived classes can be thrown and caught by catch clauses denoting an unambiguous base, has not been implemented.

      #include <assert.h>

      struct BaseClass {
          int i;
          BaseClass() : i(0) { }
          BaseClass(int ii) : i(ii) { }
          BaseClass(const BaseClass& r) : i(r.i) { }
      };

      class DerivedClass : BaseClass {
          int ib;
        public:
          DerivedClass(const DerivedClass& r) : BaseClass(r.ib), ib(r.ib) { }
          DerivedClass(const BaseClass&) : BaseClass(999), ib(999) { }
          DerivedClass(int ii);
      };

      DerivedClass thrown_base (1);
      DerivedClass::DerivedClass(int ii) : BaseClass(ii), ib(ii) { }

      int main() {
          try {
              throw thrown_base;
              return 999;
          }
          catch(const BaseClass &k) { }
          catch(...) { assert(false); } // Assertion fails at runtime due to core issue 1769
          return 0;
      }
      Show
      Core 1769, involving a resolution which states that derived classes can be thrown and caught by catch clauses denoting an unambiguous base, has not been implemented. #include <assert.h> struct BaseClass {     int i;     BaseClass() : i(0) { }     BaseClass(int ii) : i(ii) { }     BaseClass(const BaseClass& r) : i(r.i) { } }; class DerivedClass : BaseClass {     int ib;   public:     DerivedClass(const DerivedClass& r) : BaseClass(r.ib), ib(r.ib) { }     DerivedClass(const BaseClass&) : BaseClass(999), ib(999) { }     DerivedClass(int ii); }; DerivedClass thrown_base (1); DerivedClass::DerivedClass(int ii) : BaseClass(ii), ib(ii) { } int main() {     try {         throw thrown_base;         return 999;     }     catch(const BaseClass &k) { }     catch(...) { assert(false); } // Assertion fails at runtime due to core issue 1769     return 0; }

      Unimplemented core issue 1769: Catching a thrown derived class by reference to base clas

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

              Created:
              Updated: