>Submitter-Id: net >Originator: Agostinho Maschio >Organization: Reckon Engenharia de Sistemas Ltda >Confidential: no >Synopsis: assign to std::string from int causes NO ERROR >Severity: serious >Priority: medium >Category: c++ >Class: accepts-illegal >Release: 3.0.4 (Debian testing/unstable) >Environment: System: Linux genesis 2.4.19-genesis #2 Wed Sep 4 08:21:39 BRT 2002 i686 unknown Architecture: i686
host: i386-pc-linux-gnu build: i386-pc-linux-gnu target: i386-pc-linux-gnu configured with: ../src/configure -v --enable-languages=c,c++,java,f77,proto,objc --prefix=/usr --infodir=/share/info --mandir=/share/man --enable-shared --with-gnu-as --with-gnu-ld --with-system-zlib --enable-long-long --enable-nls --without-included-gettext --disable-checking --enable-threads=posix --enable-java-gc=boehm --with-cpp-install-dir=bin --enable-objc-gc i386-linux >Description: (Sorry, I don't have a good English) The compiler allows an assign to an string object from an int without display any error or warning >How-To-Repeat: Try the following code: // # g++3 --version // # 3.0.4 #include <map> #include <string> using namespace std; typedef map<string,string> dict; int main(int argc, char *argv[]) { dict x; string key="key"; //string z=2; // OK: does NOT compile x[key] = 2; // BUG???: compiles OK } >Fix: