Skip to content

Commit

Permalink
Fix for SST_ELI_DECLARE_NEW_BASE when BuilderInfo is a dependent …
Browse files Browse the repository at this point in the history
…name. (#1006)

This is easier to describe with an example first. Imagine the following code:

```c++
template <class Component>
struct MyComponentBase : public Component {
    SST_ELI_DECLARE_NEW_BASE(Component, MyComponentBase);
    // tools that help us with SST::Component interfaces
};

struct MyComponent : MyComponentBase<SST::Component> {
    // A custom component
};

struct MyRouter : MyComponentBase<SST::Merlin::Router> {
    // A merlin router implementation
};
```

In this context, inside the `SST_ELI_DECLARE_NEW_BASE`, the `BuilderInfo` is a
dependent name in the `addDerivedInfo` template function, and can't be found
without qualification. The qualified name is `__LocalEliBase::BuilderInfo` and
it needs a `typename` pre-C++20.

This patch adds that typename to support this template pattern. This pattern
allows us to write utility code that can be injected into _any_ component
hierarchy.
  • Loading branch information
ldalessa authored Oct 14, 2023
1 parent bd3ccd7 commit a29db3c
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/sst/core/eli/elibase.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ class LoadedLibraries
template <class __TT> \
static bool addDerivedInfo(const std::string& lib, const std::string& elem) \
{ \
using BuilderInfo = typename __LocalEliBase::BuilderInfo; \
return addInfo(lib, elem, new BuilderInfo(lib, elem, (__TT*)nullptr)); \
}

Expand Down

0 comments on commit a29db3c

Please sign in to comment.