The problem is that a literal 0 is a null pointer constant. The compiler doesn’t know if you meant:
std::string::operator +=(const char*); // tmp += "abc";
or
std::string::operator +=(char); // tmp += 'a';
(better compilers list the options).
The workround (as you have discovered) is to write the append as:
tmp += '\0';
(I assume you didn’t want the string version – tmp += nullptr; would be UB at runtime.)