O
Old Wolf
My compiler rejects this:
std::string foo()
{
std::string s;
return some_condition() ? s : "";
}
saying that the last two operands of ?: must be the same type.
I have to fix it by changing "" to std::string() .
Is this correct behaviour? I remember reading that the compiler
ought to try implicitly converting one of the operands to the
type of the other.
std::string foo()
{
std::string s;
return some_condition() ? s : "";
}
saying that the last two operands of ?: must be the same type.
I have to fix it by changing "" to std::string() .
Is this correct behaviour? I remember reading that the compiler
ought to try implicitly converting one of the operands to the
type of the other.