If I have class that has two member data x_ and y_ declared so that x_ is initialized from y_ and y_ has a value then is x_ has an Undefined value? or what?
class Empl {
public:
int x_{ y_ };
int y_{ 10 };
};
int main(){
Empl e{};
std::cout << e.x_ << ", " << e.y_ << std::endl;
}
I tried the example on MSVC++ 2105 and got: 0 and 10 while on GCC I got 10 and 10!
So as a result is it undefined behavior to do so?