I'm noticing wrong filenames and line numbers on error messages when combining optimised build with c++0x and precompiled headers. Here is a minimal test case:
All.h: #include <string> test.h: #include "All.h" test.cpp: #include "test.h" Test::Test() { } g++ -std=gnu++0x -O3 All.h g++ -std=gnu++0x -O3 test.cpp test.h:2: error: Test has not been declared test.h:2: error: ISO C++ forbids declaration of Test with no type If I: - Don't use gnu++0x - Or don't use -O3 - Or don't precompile All.h - Or include All.h directly in test.cpp then I get the expected error message test.cpp:3: error: Test has not been declared test.cpp:3: error: ISO C++ forbids declaration of Test with no type System: Linux 2.6.32-5-amd64 #1 SMP Tue Jun 1 04:34:03 UTC 2010 x86_64 GNU/Linux g++ -v -save-temps: Using built-in specs. Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Debian 4.4.4-1' --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared --enable-multiarch --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4 --program-suffix=-4.4 --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --with-arch-32=i486 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 4.4.4 (Debian 4.4.4-1) -- Summary: Wrong filename in error message when using c++0x + optimised + precompiled headers Product: gcc Version: 4.4.4 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: small_duck at revesdemondes dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44550