I isolated the code fragment and dumped it into its own project - you're right - it runs without any assertion errors. I now suspect the issue might lie with something else in the codebase / project that I am working on (it's much much larger) and perhaps something subtle that someone forgot to mention to me.

But for the assertion, it was in AFX.INL on line 122, which is:

{ ASSERT(m_pchData != NULL); return ((CStringData*)m_pchData)-1; }

Turns out that the m_pchData variable was NULL. I wasn't sure what strategy I should have used to trace this error - how would one go on to debug something like this?