#include <iostream>
#include <typeinfo>
using namespace std;
//if(flag) -> int foo(bool);
//else -> double foo(bool);
auto foo(bool flag) ->decltype(flag ? 1 : 1.0)
{
if(flag) return 1;
else return 1.0;
}
int main()
{
std::cout << typeid(foo(true)).name() << std::endl;
std::cout << typeid(foo(false)).name() << std::endl;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dHlwZWluZm8+Cgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKLy9pZihmbGFnKSAtPiBpbnQgZm9vKGJvb2wpOwovL2Vsc2UgICAgIC0+IGRvdWJsZSBmb28oYm9vbCk7CgphdXRvIGZvbyhib29sIGZsYWcpIC0+ZGVjbHR5cGUoZmxhZyA/IDEgOiAxLjApCnsKICAgIGlmKGZsYWcpICAgIHJldHVybiAxOwogICAgZWxzZSAgICAgICAgcmV0dXJuIDEuMDsKfQoKaW50IG1haW4oKQp7CiAgICBzdGQ6OmNvdXQgPDwgdHlwZWlkKGZvbyh0cnVlKSkubmFtZSgpIDw8IHN0ZDo6ZW5kbDsKICAgIHN0ZDo6Y291dCA8PCB0eXBlaWQoZm9vKGZhbHNlKSkubmFtZSgpIDw8IHN0ZDo6ZW5kbDsKICAgIHJldHVybiAwOwp9Cg==