From 95737d272152308327b287496298fafafd7acd86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Wed, 6 Nov 2019 13:06:58 +0100 Subject: [PATCH] cpp: Add default constructor for HostContext --- include/evmc/evmc.hpp | 5 ++++- test/unittests/test_cpp.cpp | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/include/evmc/evmc.hpp b/include/evmc/evmc.hpp index edc54f7..2e3af07 100644 --- a/include/evmc/evmc.hpp +++ b/include/evmc/evmc.hpp @@ -501,7 +501,10 @@ class HostContext : public HostInterface evmc_tx_context tx_context = {}; public: - /// Implicit converting constructor from evmc_host_context. + /// Default constructor for null Host context. + HostContext() = default; + + /// Constructor from the EVMC Host primitives. HostContext(const evmc_host_interface* interface, evmc_host_context* ctx) noexcept : host{interface}, context{ctx} {} diff --git a/test/unittests/test_cpp.cpp b/test/unittests/test_cpp.cpp index fd6260b..6637d25 100644 --- a/test/unittests/test_cpp.cpp +++ b/test/unittests/test_cpp.cpp @@ -404,9 +404,10 @@ TEST(cpp, host_call) { // Use example host to test Host::call() method. + auto host = evmc::HostContext{}; // Use default constructor. auto* host_interface = example_host_get_interface(); auto* host_context = example_host_create_context(evmc_tx_context{}); - auto host = evmc::HostContext{host_interface, host_context}; + host = evmc::HostContext{host_interface, host_context}; EXPECT_EQ(host.call({}).gas_left, 0);