I expect the following program to return 0 all of the time. However with Visual Studio 2013 (Update 4), the program exits 1 in release builds. I\'m not sure if this is a bug
No, this optimization does not conform to the C++ standard. The declaration of uniqueMemLoc defines a unique object for each instance of the template, and each object has its own address.
(If you had used a string literal, it would be a different story. The optimization would be valid in that case.)