We don't need to use the namespace std at all. MS version of STL already takes care of it. If the HP version is used, which it wasn't in this case and we'll not consider to use, then an explicit namespace is required.

Please notice the following points in my original question:

1. Changing pair<string, string> to pair<int, int> will work. So it is definitely not a namespace problem.

2. The map key and both the elements in the pair are of the same data type, i.e. string. I keep wondering whether it is not "allowed" to have the data and the key to be the same type (???).

The following encloses the compiler error message:

Compiling...
test_map.cpp
C:\MSDEV\INCLUDE\xtree(153) : fatal error C1001: INTERNAL COMPILER ERROR
(compiler file 'd:\backend\src\P2\main.c', line 413)
Please choose the Technical Support command on the Visual C++
Help menu, or open the Technical Support help file for more information
Error executing cl.exe.

please tell us what command-line switches you're using to cause the internal compiler error message. (This is the same question you'd be asked if you called Product Support Services, as the error message requests.)

The code you've provided here still does't cause an ICE with either of the option sets that you've provided. I'm not using the /Fp option you've provided, of course, since I don't have the code you're using to generate your PCH file.

This strongly suggests that the problem is because of some code that you still haven't shared with us.

Hello! Your code seems syntactically right.I've succeed to compile your code in the MSVC++4.2 with your settings in the debug mode as well as in the release mode. There is only difference I work under NT platform.One of the often occured reasons of ICE is a giant length of full names of objects in STL. The warning 4786 is warns about name truncating into debug info.The line xtree(153) is a constructor of _Tree class. It is the one of the longest names in the STL. Here it is:_Tree<basic_string<char,char_traits<char>,allocator<char>>,pair<basic_string<char,char_traits<char>,allocator<char>>,pair<basic_string<char,char_traits<char>,allocator<char>>,basic_string<char,char_traits<char>,allocator<char>>>>,map<basic_string<char,char_traits<char>,allocator<char>>,pair<basic_string<char,char_traits<char>,allocator<char>>,basic_string<char,char_traits<char>,allocator<char>>>,less<basic_string<char,char_traits<char>,allocator<char>>>,allocator<pair<basic_string<char,char_traits<char>,allocator<char>>,basic_string<char,char_traits<char>,allocator<char>>>>>::_Kfn,less<basic_string<char,char_traits<char>,allocator<char>>>,allocator<pair<basic_string<char,char_traits<char>,allocator<char>>,basic_string<char,char_traits<char>,allocator<char>>>>>::_Tree<basic_string<char,char_traits<char>,allocator<char>>,pair<basic_string<char,char_traits<char>,allocator<char>>,pair<basic_string<char,char_traits<char>,allocator<char>>,basic_string<char,char_traits<char>,allocator<char>>>>,map<basic_string<char,char_traits<char>,allocator<char>>,pair<basic_string<char,char_traits<char>,allocator<char>>,basic_string<char,char_traits<char>,allocator<char>>>,less<basic_string<char,char_traits<char>,allocator<char>>>,allocator<pair<basic_string<char,char_traits<char>,allocator<char>>,basic_string<char,char_traits<char>,allocator<char>>>>>::_Kfn,less<basic_string<char,char_traits<char>,allocator<char>>>,allocator<pair<basic_string<char,char_traits<char>,allocator<char>>,basic_string<char,char_traits<char>,allocator<char>>>>>'The other reason of the fault is the reserved word "explicit".It means do not do implicit conversions of input parameters of the function. MSVC++4.2 compiler compile but don't regards this new keyword. It could have a bug in combination with a name length.Well, what to do? Something of this:1) play with compiler options. It should help.2) try to use less robust object than map<string, PairType, ::less<string>, allocator<PairType> > MapType;(if you can)3) to remove explicit keyword from xtree(153);4) to upgrade compiler to 5.0. Many template bugs were corrected in this version.5) try to compile under NT. (It is slightly different compiler code running for Win95 and NT)For the clarity of the experiment close all other applications.

Best wishes, Sergey

Not the solution you were looking for? Getting a personalized solution is easy.