Uploaded image for project: 'ROOT'
  1. ROOT
  2. ROOT-10872

cppyy tries to generate copy constructors for non copyable classes

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Closed (View Workflow)
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: master, 6.22/00
    • Fix Version/s: master, 6.22/04
    • Component/s: None
    • Labels:
      None
    • Environment:

      LHCb nightly builds against ROOT 6.22-patches and master

      Description

      This simple example does work with ROOT 6.20, but fails with ROOT 6.22:

      import cppyy
      cppyy.gbl.gInterpreter.Declare('''
      struct NoCopy {
        NoCopy() = default;
        NoCopy(const NoCopy&) = delete;
        virtual ~NoCopy() = default;
      };
      struct MyClass : NoCopy {};
      ''')
      class MyDerived(cppyy.gbl.MyClass):
          pass
      

      because it tries to generate a dispatcher class with an explicit copy constructor.
       
      This is the full log:

      $ source /cvmfs/sft-nightlies.cern.ch/lcg/views/dev4/Mon/x86_64-centos7-gcc9-opt/setup.sh
      $ python
      Python 2.7.16 (default, Apr 30 2020, 17:53:11) 
      [GCC 9.2.0] on linux2
      Type "help", "copyright", "credits" or "license" for more information.
      >>> import cppyy
      /cvmfs/sft-nightlies.cern.ch/lcg/views/dev4/Mon/x86_64-centos7-gcc9-opt/lib/cppyy_backend/loader.py:113: UserWarning: No precompiled header available (/cvmfs/sft-nightlies.cern.ch/lcg/views/dev4/Mon/x86_64-centos7-gcc9-opt/lib/cppyy_backend/etc not writable); this may impact performance.
        warnings.warn('No precompiled header available (%s); this may impact performance.' % msg)
      >>> cppyy.gbl.gInterpreter.Declare('''
      ... struct NoCopy {
      ...   NoCopy() = default;
      ...   NoCopy(const NoCopy&) = delete;
      ...   virtual ~NoCopy() = default;
      ... };
      ... struct MyClass : NoCopy {};
      ... ''')
      True
      >>> class MyDerived(cppyy.gbl.MyClass):
      ...     pass
      ... 
      input_line_26:9:43: error: call to implicitly-deleted copy constructor of '::MyClass'
        Dispatcher1(const Dispatcher1& other) : MyClass(other), m_self(other.m_self, this) {}
                                                ^       ~~~~~
      input_line_24:7:18: note: copy constructor of 'MyClass' is implicitly deleted because base class 'NoCopy' has a deleted copy constructor
      struct MyClass : NoCopy {};
                       ^
      input_line_24:4:3: note: 'NoCopy' has been explicitly marked deleted here
        NoCopy(const NoCopy&) = delete;
        ^
      __main__:1: RuntimeWarning: no python-side overrides supported
      >>> 
      

        Attachments

          Activity

            People

            • Assignee:
              etejedor Enric Tejedor Saavedra
              Reporter:
              clemenci Marco Clemencic
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: