In C++ given
— Shafik Yaghmour (@shafikyaghmour) December 29, 2018
struct S {
int x = 1;
void mf() {x = 2;}
};
int f(bool cond) {
S s;
(cond ? s : throw 0).mf();
return s.x;
}
What does
f(true);
Return?
Vote first, answer 👇
A. 1
B. 2
C. Undefined behavior
D. Depends on the standard#CppPolls #Cplusplus