B-Lang-org / bsc

Bluespec Compiler (BSC)
Other
902 stars 141 forks source link

Bluesim: Fix templated classes for C++20 #701

Closed quark17 closed 1 month ago

quark17 commented 1 month ago

Earlier C++ standards allowed the constructor and destructor of a templated class to be declared with a templated identifier. For example:

template<typename T>
class Foo {
 public:
  Foo<T>();
  ~Foo<T>();
};

This is not accepted by the newer C++ standard, and GCC warns about that:

warning: template-id not allowed for constructor in C++20 [-Wtemplate-id-cdtor]

This PR resolves it by removing the unnecessary parameters in the constructor and destructor identifiers:

template<typename T>
class Foo {
 public:
  Foo();
  ~Foo();
};