I mistakenly pasted a throw
statement after a return
with the following final result:
void DXManager::initialize(const std::shared_ptr<nae::Context>& ctx_ptr)
{
// ...
if (FAILED(result))
{
return throw std::exception("Failed to enumerate display mode list");
}
// ...
}
I successfully built the solution before noticing the mistake, and I'm curious which specification allows the syntax above.
By reading cppreference.com (under Notes), I see
The throw-expression is classified as prvalue expression of type void. Like any other expression, it may be a sub-expression in another expression, most commonly in the conditional operator:
double f(double d) { return d > 1e7 ? throw std::overflow_error("too big") : d; } // ...
but I'm not quite sure it's what I'm looking for.