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 #1855, #2211 #2213

Merged
merged 9 commits into from
Jun 16, 2018
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
1 change: 1 addition & 0 deletions contributors.txt
Original file line number Diff line number Diff line change
Expand Up @@ -182,3 +182,4 @@ YYYY/MM/DD, github id, Full name, email
2017/12/27, jkmar, Jakub Marciniszyn, marciniszyn.jk@gmail.com
2018/02/11, io7m, Mark Raynsford, code@io7m.com
2018/15/05, johnvanderholt, jan dillingh johnvanderholte@gmail.com
2018/06/16, EternalPhane, Zongyuan Zuo, eternalphane@gmail.com
3 changes: 0 additions & 3 deletions runtime/Cpp/runtime/src/support/Any.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,3 @@ Any::~Any()
{
delete _ptr;
}

Any::Base::~Base() {
}
13 changes: 12 additions & 1 deletion runtime/Cpp/runtime/src/support/Any.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ struct ANTLR4CPP_PUBLIC Any

private:
struct Base {
virtual ~Base();
virtual ~Base() {};
virtual Base* clone() const = 0;
};

Expand All @@ -112,10 +112,21 @@ struct ANTLR4CPP_PUBLIC Any

T value;

Base* clone() const {
return clone<>();
}

private:
template<int N = 0, typename std::enable_if<N == N && std::is_nothrow_copy_constructible<T>::value, int>::type = 0>
Base* clone() const {
return new Derived<T>(value);
}

template<int N = 0, typename std::enable_if<N == N && !std::is_nothrow_copy_constructible<T>::value, int>::type = 0>
Base* clone() const {
return nullptr;
}

};

Base* clone() const
Expand Down