I stumbled across a strange (for me) behavior. Here is my code:
struct A
{
operator unsigned long long() const { return 1ull << 32; }
};
A a1;
unsigned long long a2 = 1ull << 32;
bool b = rand() % 2;
auto c1 = b ? a1 : 0;
auto c2 = b ? a2 : 0;
Why is c1 of type int and not unsigned long long like c2? And why is there no conversion warning generated (VC++)?
It took me a day to figure out what's wrong with my application.