Fix a bug causing the program not to start

This bug was introduced in ac4799abafbeb1d44d1b7166913406cd3a46b560.

This bug apparently only affected MSVC since the evaluation order of function
call parameters respect to other parameters is unspecified by the C++
specification.

Fixes #785.
This commit is contained in:
yvt 2018-10-31 16:12:46 +09:00
parent cafb664e8e
commit 3cd581260a
2 changed files with 9 additions and 1 deletions

View File

@ -144,5 +144,13 @@ namespace spades {
ptr = nullptr;
return {other, false};
}
/**
* Attempts to cast this `Handle<T>` to `Handle<S>` using `dynamic_cast`.
* Throws an exception if the cast was unsuccessful.
*/
template <class S> Handle<S> Cast() const & {
return Handle{*this}.Cast<S>();
}
};
}

View File

@ -417,7 +417,7 @@ namespace spades {
auto port = Handle<SDLSWPort>::New(wnd);
return std::make_tuple(
Handle<draw::SWRenderer>::New(port).Cast<client::IRenderer>(),
std::move(port).Cast<Disposable>());
port.Cast<Disposable>());
}
default: SPRaise("Invalid renderer type");
}