The following testing code does correctly in VS either with debug or release, and also in GCC. It also does correctly for ICC with debug, but not when optimization enabled (
It sure sounds like a bug. Here's a (pretty wild) guess about what reasoning might have lead to it...
After inlining, it sees:
while (q.m_first == q.m_last) /* do nothing */ ;
do_something();
and any sequence of do nothing repeatedly ; do something can be translated to simply "do something". This falls down if the repeated part is endless (as in this case). But perhaps they don't test their compiling on examples that intentionally have endless looping ;-).