C++ Exam being Weird
The correct answer to this question is "This program is ill-formed". I don't think this is the answer the professor is expecting.
The C++ standards do not specify any behaviour for ill-formed programs. In a very real sense, it is not a C++ program.
It also looks like Microsoft don't define what Visual Studio does with that code, only that it does something, and that something isn't compliant with ISO C++.
If you instead had const Hello& hob = Aloha("Bob");
, there wouldn't be a spurious "Aloha Bye, Bob" in the output, because the Aloha
wouldn't be destroyed on that line.
Similarly Hello bob = Aloha("Bob");
is correctly rejected by Visual Studio.