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

shared_ptr::get_deleter() should return the original deleter class without copying

    XMLWordPrintable

Details

    • Bug
    • Status: New
    • Low
    • Resolution: Unresolved
    • Code Generation Tools
    • CODEGEN-4050
    • Hide
      ARM_18.1.0.LTS
      ARM_18.12.0.LTS
      ARM_20.2.0.LTS
      Show
      ARM_18.1.0.LTS ARM_18.12.0.LTS ARM_20.2.0.LTS

    Description

      shared_ptr::get_deleter() should return the original deleter class without copying. Test case:

      #include <stdio.h>
      #include <memory>
      struct S {
      int m;
      S(int i) : m {}
      };

      bool flag = false;

      struct Deleter {
      int m;
      Deleter() : m(1) {}
      Deleter(const Deleter& d)

      { m = 2*d.m; }

      void operator() (void* p)

      { flag = true; }

      };

      int main(void)

      { Deleter x00; std::shared_ptr<char> p00(new char, x00); Deleter* pg00 = std::get_deleter<Deleter, char>(p00); if ( pg00 != &x00) printf("Got m=%d instead of m=%d.\n", pg00->m, x00.m); }

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated: