Several things could happen the most likely being
- The flag is considered helpful by a mod and the answer is converted to a comment - the OP ends up confused/unhappy as they have provided an answer.
- The flag is considered invalid by a mod - I'm unhappy as I flagged in good faith.
- The mod realises what's happened and leaves it all as it should be.
This uncertainty could be avoided if the system automagically removed flags from posts that the OP changes after the flag is cast.