Jump to content

inherited virtual base class 'sc_core::sc_interface' has private destructor error when compile tlm1/bidir example


Recommended Posts

I am try to compile tlm1/bidir example from uvm-systemc-1.0-beta1 with SystemC 2.3.2

I got error as below and I have no idea what I have done wrong.

~/systemc/include/tlm_core/tlm_1/tlm_req_rsp/tlm_channels/tlm_req_rsp_channels/tlm_put_get_imp.h:87:7: error: inherited virtual base class 'sc_core::sc_interface' has private destructor
class tlm_master_imp :
      ^

 

I have attached the full compile log

comp.log

Link to comment
Share on other sites

  • 1 month later...
  • 1 month later...
On 5/3/2018 at 10:03 PM, Philipp A Hartmann said:

You did nothing wrong. This is an issue with Clang/LLVM-based compilers and their specific treatment of virtual private inheritance, see e.g. https://bugs.llvm.org/show_bug.cgi?id=30916. Other compilers accept this code.

 Greetings from Duisburg,
  Philipp

Hello Philipp,

Would it be possible to bypass the bug by explicitly deleting the destructor [public : ~mclass() = delete;] if the the chosen c++ standard is at or above c++11 ?

It started hurting now.

Regards,

Sumit

Link to comment
Share on other sites

Hi Sumit,

I re-checked the LLVM issue and it now refers to C++ CWG issue #7 (http://www.open-std.org/Jtc1/sc22/wg21/docs/cwg_closed.html#7), which clearly describes our situation here and shows that the current implementation of tlm_req_rsp_channel<...> is invalid C++ in SystemC (even though only Clang rejects it so far).

Without changing the inheritance pattern, the only fix would be to add "friend" declarations to all (indirect) virtual base classes of tlm_put_get_impl<...>, including sc_interface.  This is not an option, so I think the internal implementation of the tlm_req_rsp_channel<...> needs to be refactored to avoid the private virtual inheritance.  I have opened an issue in the SystemC Language WG bug tracker for this.

Greetings from Duisburg,
  Philipp

Link to comment
Share on other sites

  • 2 weeks later...

In fact the fix is relatively simple, and will hopefully be in the next release (meantime, please find attached a small patch). The real question is why this inheritance structure was like this in the first place. Here's the PR rational: 

  • class tlm_put_get_imp <class1, class2> inherits private virtual from tlm_put_if<class1>, and tlm_get_peek_if<class2>
  • tlm_put_if and tlm_get_peek_if are compounded class that are interfaces, which means that they (and their parents) have only pure virtual methods
  • but these must be implemented because they are pure, so are they in tlm_put_get_imp, as publicmethods.
    So there is no point in the private inheritance.

(Special thanks to Luc Michel from GreenSocs who helped sort this out)

 

 

tlm1.patch

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...