diff options
Diffstat (limited to 'src/common.h')
-rw-r--r-- | src/common.h | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/common.h b/src/common.h index d65306bc..370e0cbd 100644 --- a/src/common.h +++ b/src/common.h @@ -120,8 +120,19 @@ void Destruct(T& placement) { placement.~T(); } +// This is named MakeUnique instead of make_unique because make_unique has the +// potential to conflict with std::make_unique if it is defined. +// +// On gcc/clang, we currently compile with c++11, which doesn't define +// std::make_unique, but on MSVC the newest C++ version is always used, which +// includes std::make_unique. If an argument from the std namespace is used, it +// will cause ADL to find std::make_unique, and an unqualified call to +// make_unique will be ambiguous. We can work around this by fully qualifying +// the call (i.e. wabt::make_unique), but it's simpler to just use a different +// name. It's also more consistent with other names in the wabt namespace, +// which use CamelCase. template <typename T, typename... Args> -std::unique_ptr<T> make_unique(Args&&... args) { +std::unique_ptr<T> MakeUnique(Args&&... args) { return std::unique_ptr<T>(new T(std::forward<Args>(args)...)); } @@ -251,9 +262,9 @@ enum class ExternalKind { static const int kExternalKindCount = WABT_ENUM_COUNT(ExternalKind); struct Limits { - uint64_t initial; - uint64_t max; - bool has_max; + uint64_t initial = 0; + uint64_t max = 0; + bool has_max = false; }; enum { WABT_USE_NATURAL_ALIGNMENT = 0xFFFFFFFF }; |