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 -Wmaybe-uninitialized warnings in move constructors #260

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions src/hir/type_ref.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/
#pragma once

#include <utility>
#include <rc_string.hpp>
#include <span.hpp>

Expand Down Expand Up @@ -63,9 +64,8 @@ class TypeRef
TypeRef();
explicit TypeRef(const TypeRef& x);
TypeRef(TypeRef&& x):
m_ptr(x.m_ptr)
m_ptr(::std::exchange(x.m_ptr, nullptr))
{
x.m_ptr = nullptr;
}
~TypeRef();

Expand Down
4 changes: 2 additions & 2 deletions src/include/rc_string.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

#include <cstring>
#include <ostream>
#include <utility>
#include "../common.hpp"

class RcString
Expand Down Expand Up @@ -47,9 +48,8 @@ class RcString
if( m_ptr ) m_ptr->refcount += 1;
}
RcString(RcString&& x):
m_ptr(x.m_ptr)
m_ptr(::std::exchange(x.m_ptr, nullptr))
{
x.m_ptr = nullptr;
}

~RcString();
Expand Down
4 changes: 2 additions & 2 deletions src/include/span.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <rc_string.hpp>
#include <functional>
#include <memory>
#include <utility>

enum ErrorType
{
Expand Down Expand Up @@ -45,9 +46,8 @@ struct Span

Span(const Span& x);
Span(Span&& x):
m_ptr(x.m_ptr)
m_ptr(::std::exchange(x.m_ptr, nullptr))
{
x.m_ptr = nullptr;
}

Span& operator=(const Span& x)
Expand Down