String matching would not distinguish a local variable or instance variable named "X" from a method named "X" from a class name "X".
My understanding of the Refactoring tools (Smalltalk and otherwise) is that they are operating on the same level of information the compiler operates on: it does distinguish between a class named X, a method named X, a local variable named X, etc.
There is a danger when strings (perhaps read from an external file) are used to look up classes, methods, or whatever... the exact same danger exists in Java. On the other hand, C++ doesn't have any way to go from a string to a class or method, so it's "safe", though the syntax of C++ is so hairy, and the lack of reflection such a big problem, that there are no refactoring tools for C++ yet. [I hear one is in development, but that's it.]