I can't compile, the following snippet (yes it 's stupid!): #include <iostream> #include <string> using namespace std; int main(){ string s; if(!s) cout << "yo!" << endl; return (0); } Compiler fails. main.cpp: Dans function
I can't compile, the following snippet (yes it 's stupid!): #include <iostream> #include <string> using namespace std; int main(){ string s; if(!s) cout << "yo!" << endl; return (0); } Compiler fails. main.cpp: Dans function « int main() »: main.cpp:8: no match pour l'opérateur « erreur interne de compilateur: erreur pour rapporter une routine ré-entée SVP soumettre un rapport complet d'anomalies, avec le source pré-traité si cela est approprié. Reproducible: Always Steps to Reproduce: 1. 2. 3. Actual Results: main.cpp: Dans function « int main() »: main.cpp:8: no match pour l'opérateur « erreur interne de compilateur: erreur pour rapporter une routine ré-entée SVP soumettre un rapport complet d'anomalies, avec le source pré-traité si cela est approprié. Expected Results: Say me I'm stupid to test if string is boolean. gcc -v Lecture des spécification à partir de /usr/lib/gcc-lib/i486-pc-linux-gnu/3.2.3/specs Configuré avec: /var/tmp/portage/gcc-3.2.3-r1/work/gcc-3.2.3/configure --prefix=/usr --bindir=/usr/i486-pc-linux-gnu/gcc-bin/3.2 --includedir=/usr/lib/gcc-lib/i486-pc-linux-gnu/3.2.3/include --datadir=/usr/share/gcc-data/i486-pc-linux-gnu/3.2 --mandir=/usr/share/gcc-data/i486-pc-linux-gnu/3.2/man --infodir=/usr/share/gcc-data/i486-pc-linux-gnu/3.2/info --enable-shared --host=i486-pc-linux-gnu --target=i486-pc-linux-gnu --with-system-zlib --enable-languages=c,c++,ada,f77,objc,java --enable-threads=posix --enable-long-long --disable-checking --enable-cstdio=stdio --enable-clocale=generic --enable-__cxa_atexit --enable-version-specific-runtime-libs --with-gxx-include-dir=/usr/lib/gcc-lib/i486-pc-linux-gnu/3.2.3/include/g++-v3 --with-local-prefix=/usr/local --enable-shared --enable-nls --without-included-gettext Modèle de thread: posix version gcc 3.2.3 20030422 (Gentoo Linux 1.4 3.2.3-r1, propolice)
I get this (seems same as your french one): -- $ g++ cxx.c -o cxx cxx.c: In function `int main()': cxx.c:8: error: no match for 'operator!' in '!s' cxx.c:8: error: candidates are: operator!(bool) <built-in> -- That is _not_ an internal compiler error. It basically means the string class do not have a ! operator as you used it. I do not know what you want to do, but you code is invalid. The only legal use of that syntax will be: -- #include <iostream> #include <string> using namespace std; int main(){ string *s = NULL; if(!s) cout << "yo!" << endl; s = new(string); if(!s) cout << "yo2!" << endl; delete(s); return (0); } --