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

Compiler may crash when auto as return type of uninstantiated member function in template class resolves to template parameter

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Medium Medium
    • Code Generation Tools
    • CODEGEN-5986
    • Hide
      ARM_18.1.0.LTS
      MSP430_18.1.0.LTS
      C6000_8.3.0
      ARM_18.12.0.LTS
      ARM_19.6.0.STS
      MSP430_18.12.0.LTS
      MSP430_19.6.0.STS
      Show
      ARM_18.1.0.LTS MSP430_18.1.0.LTS C6000_8.3.0 ARM_18.12.0.LTS ARM_19.6.0.STS MSP430_18.12.0.LTS MSP430_19.6.0.STS
    • Hide
      ARM_18.1.6.LTS
      MSP430_18.1.6.LTS
      ARM_19.6.0.STS
      C6000_8.3.4
      ARM_18.12.3.LTS
      MSP430_19.6.0.STS
      MSP430_18.12.3.LTS
      Show
      ARM_18.1.6.LTS MSP430_18.1.6.LTS ARM_19.6.0.STS C6000_8.3.4 ARM_18.12.3.LTS MSP430_19.6.0.STS MSP430_18.12.3.LTS
    • default
    • Hide
      Avoid "auto" as the return type of a member function if its immediate resolution is a template parameter.

      Or explicitly instantiate the class or function. In the given test case, there's a variable defined with type EventSubscriberTable<int>. To avoid the problem, then, include either

          template class EventSubscriberTable<int>;

      or

          template auto EventSubscriberTable<int>::getBroadcastList(void);

      in the source file.
      Show
      Avoid "auto" as the return type of a member function if its immediate resolution is a template parameter. Or explicitly instantiate the class or function. In the given test case, there's a variable defined with type EventSubscriberTable<int>. To avoid the problem, then, include either     template class EventSubscriberTable<int>; or     template auto EventSubscriberTable<int>::getBroadcastList(void); in the source file.
    • Hide
      Given a class definition like

      template <typename T>
      class Table {
      public :
        auto getList(void) { return m_Callbacks; }

      private :
        T m_Callbacks;
      };

      where the member function getList() returns "auto" and that "auto" can be seen to be "T", and this program:

      int main(int argc, char* argv[])
      {
          Table<int> m_Table;
          return 0;
      }

      in which the Table class is instantiated but the function getList() is never used, the compiler may crash.

      The problem requires the combination of auto, template parameter, and uninstantiated function. Changing any of those details will avoid it.
      Show
      Given a class definition like template <typename T> class Table { public :   auto getList(void) { return m_Callbacks; } private :   T m_Callbacks; }; where the member function getList() returns "auto" and that "auto" can be seen to be "T", and this program: int main(int argc, char* argv[]) {     Table<int> m_Table;     return 0; } in which the Table class is instantiated but the function getList() is never used, the compiler may crash. The problem requires the combination of auto, template parameter, and uninstantiated function. Changing any of those details will avoid it.

      Compiler may crash when auto as return type of uninstantiated member function in template class resolves to template parameter

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

              Created:
              Updated:
              Resolved: