The following code issues an incorrect warning. Note, that the non-template version (fine) is fine. gonzo:/tmp # cat foo.cc template <class T> void foo(T &a) { for(int i = 0, j = 0; i != 3; ++i, ++j) a += j; } void fine(int &a) { for(int i = 0, j = 0; i != 3; ++i, ++j) a += j; } int main() { return 0; } gonzo:/tmp # /gml/shared/gcc-cvs/bin/g++ -v Reading specs from /gml/shared/gcc-cvs/lib/gcc-lib/i686-pc-linux-gnu/3.4/specs Konfiguriert mit: ../gcc/configure --prefix=/gml/shared/gcc-cvs --enable-shared --enable-languages=c,c++ --enable-threads=posix Thread model: posix gcc-Version 3.4 20030726 (experimental) gonzo:/tmp # /gml/shared/gcc-cvs/bin/g++ -Wunused-value foo.cc foo.cc: In function `void foo(T&)': foo.cc:4: Warnung: left-hand operand of comma expression has no effect
This bug is a dup of bug 11512 (which almost have the exact source). *** This bug has been marked as a duplicate of 11512 ***