For the program below. clang 3.1 returns "different" unless you optimize it with -O2 or higher. In gcc 4.2 and VC, the code always return "same" no matter in -O0 or -O2.
Some code was written with this assumption, they know all the keys are from const strings so they do pointer compare instead string compare. There're might be more code relies on this behavior.
Extended Description
For the program below. clang 3.1 returns "different" unless you optimize it with -O2 or higher. In gcc 4.2 and VC, the code always return "same" no matter in -O0 or -O2.
Some code was written with this assumption, they know all the keys are from const strings so they do pointer compare instead string compare. There're might be more code relies on this behavior.