Skip to content

Commit

Permalink
C++20 compatibility fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
shravanrn committed Jul 2, 2023
1 parent 6f58973 commit e37de9d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion include/wabt/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ Dst WABT_VECTORCALL Bitcast(Src&& value) {

template <typename T>
void ZeroMemory(T& v) {
WABT_STATIC_ASSERT(std::is_pod<T>::value);
WABT_STATIC_ASSERT(std::is_trivial<T>::value);
memset(&v, 0, sizeof(v));
}

Expand Down
4 changes: 2 additions & 2 deletions include/wabt/interp/interp-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ inline bool FreeList<Ref>::IsUsed(Index index) const {
}

template <>
inline FreeList<Ref>::~FreeList<Ref>() {}
inline FreeList<Ref>::~FreeList() {}

template <>
template <typename... Args>
Expand Down Expand Up @@ -181,7 +181,7 @@ bool FreeList<T>::IsUsed(Index index) const {
}

template <typename T>
FreeList<T>::~FreeList<T>() {
FreeList<T>::~FreeList() {
for (auto object : list_) {
if ((reinterpret_cast<uintptr_t>(object) & ptrFreeBit) == 0) {
delete object;
Expand Down
12 changes: 6 additions & 6 deletions src/resolve-names.cc
Original file line number Diff line number Diff line change
Expand Up @@ -488,12 +488,12 @@ void NameResolver::VisitFunc(Func* func) {
ResolveFuncTypeVar(&func->decl.type_var);
}

func->bindings.FindDuplicates(
[=](const BindingHash::value_type& a, const BindingHash::value_type& b) {
const char* desc =
(a.second.index < func->GetNumParams()) ? "parameter" : "local";
PrintDuplicateBindingsError(a, b, desc);
});
func->bindings.FindDuplicates([func, this](const BindingHash::value_type& a,
const BindingHash::value_type& b) {
const char* desc =
(a.second.index < func->GetNumParams()) ? "parameter" : "local";
PrintDuplicateBindingsError(a, b, desc);
});

visitor_.VisitFunc(func);
current_func_ = nullptr;
Expand Down
2 changes: 1 addition & 1 deletion src/wast-lexer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ Token WastLexer::GetToken() {
}

Location WastLexer::GetLocation() {
auto column = [=](const char* p) {
auto column = [this](const char* p) {
return std::max(1, static_cast<int>(p - line_start_ + 1));
};
return Location(filename_, line_, column(token_start_), column(cursor_));
Expand Down

0 comments on commit e37de9d

Please sign in to comment.