The statement does something. Internally it creates a copy of your string and performs the replacement operation. It then returns the new string. It just so happens your are not assigning that. There's no chance this could be ever reported as "statement with no effect". I think your confusion stems from your misunderstanding of that GCC warning message. I'm a little rough around the edges regarding GCC. But here it is:
which does nothing. The compiler thought doesn't gave me a warning, something equivalent to the "statement with no effect" you get from GCC.