[Glacier] Call an object's destructor in an ErrorOr
This commit is contained in:
parent
f31652b981
commit
f8f839d8e7
|
@ -11,8 +11,11 @@ class ErrorOr {
|
|||
ErrorOr() = delete;
|
||||
ErrorOr(const ErrorOr&) = delete;
|
||||
ErrorOr(ErrorOr&&) = delete;
|
||||
// FIXME: Do we have to call ~T manually here.
|
||||
~ErrorOr() {}
|
||||
~ErrorOr() {
|
||||
if (ok_) {
|
||||
obj_.~T();
|
||||
}
|
||||
}
|
||||
|
||||
ErrorOr(ErrorCode code) : error_(code), ok_(false) {}
|
||||
ErrorOr(const T& obj) : obj_(obj), ok_(true) {}
|
||||
|
|
Loading…
Reference in New Issue