It’s fixed by adding a special case to the parsing rules when parsing template arguments.
C++11 14.2/3: When parsing a template-argument-list, the first non-nested
>
is taken as the ending delimiter rather than a greater-than operator. Similarly, the first non-nested>>
is treated as two consecutive but distinct>
tokens, the first of which is taken as the end of the template-argument-list and completes the template-id.