Jump to content
enchanter

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

Share this post


Link to post
Share on other sites

Thanks ... I ran into this problem as well with clang++

 

Any known issues with mixing SystemC compiled in clang++ and uvm-systemc compiled in g++?

Or should I recompile my SystemC install as well?

Thanks,

Ian

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×