VC10 and GCC 4.4 accept the following, while Sun Studio 12 does not:
std::pair<char*, int> p1;
std::pair<char* const, int> p2;
p1 = p2
Sun Studio 12 complains:
Error: Cannot use std::pair<char*const,
int> to initialize
std::pair<char*, int>.
Any ideas why this is happening and how I can get Sun Studio to ignore this. I am working with a third party library, which would be a pain to rewrite just for this sort of thing.
It seems to be a known issue with Sun’s std library.
Your best bet may be to convince the author of the code to replace the assignment with:
Or at construction time: