Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Add a virtual destructor to DependencyProvider #50

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions cpp/include/resolvo_dependency_provider.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ using cbindgen_private::VersionSetId;
* An interface that implements ecosystem specific logic.
*/
struct DependencyProvider {
virtual ~DependencyProvider() = default;

/**
* Returns a user-friendly string representation of the specified solvable.
*
Expand Down
5 changes: 5 additions & 0 deletions cpp/tests/solve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,11 @@ SCENARIO("Solve") {
/// Construct a database with packages a, b, and c.
PackageDatabase db;

// Check that PackageDatabase correctly implements the DependencyProvider interface
static_assert(std::has_virtual_destructor_v<PackageDatabase>);
static_assert(std::is_polymorphic_v<PackageDatabase>);
static_assert(std::is_base_of_v<resolvo::DependencyProvider, PackageDatabase>);

auto a_1 = db.alloc_candidate("a", 1, {{db.alloc_requirement("b", 1, 4)}, {}});
auto a_2 = db.alloc_candidate("a", 2, {{db.alloc_requirement("b", 1, 4)}, {}});
auto a_3 = db.alloc_candidate("a", 3, {{db.alloc_requirement("b", 4, 7)}, {}});
Expand Down
Loading