The following code tests the use of std::map with std::string as a key:
#include <stdio.h>
#include <map>
#include <string>
using namespace std;
typedef map<string, int> test_map_t;
int main(int argc, char **argv) {
test_map_t test_map;
test_map["test1"]= 1;
test_map["test2"]= 2;
test_map["test3"]= 3;
string tmp= "test1";
printf("%s : %d \n", tmp.c_str(), test_map[tmp]);
return 0;
}
When compiled with ordinary gcc, this test will print out "test1 : 1", as expected. However, when compiled with alchemy it will print "test1 : 3" (!). Something is very wrong here.
Are there any workarounds for this or am I just stuck?