There is nothing wrong with the function
per se, except that it is not platform-independent, and well, neither is Direct3D or any of the various functions needed to create windows and handle input messages
The main problem is that an update to Visual C++ compiler broke their implementation, which also happens to standard functions btw. It's one of the reasons why I recommended that people don't jump to VS2017 right away. To be honest though, I would not have expected this kind of bug at this point (I hope it would have stabilized by now).
Anyways it apparently works in Release mode, so for the sake of the tutorials, you can just run it in Release as a workaround (which is sub-optimal for doing this bullshit, but maybe it will teach you the skill of debugging without a debugger, which is super annoying but comes up) and all will be well.
https://developercommunity.visualstudio ... loops.html