Bug 44550 - [C++0x] Wrong filename in error message when using c++0x + optimised + precompiled headers
[C++0x] Wrong filename in error message when using c++0x + optimised + precom...
Status: RESOLVED FIXED
Product: gcc
Classification: Unclassified
Component: c++
4.4.4
: P3 normal
: ---
Assigned To: Not yet assigned to anyone
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-06-15 22:05 UTC by Fred
Modified: 2011-10-17 18:10 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Fred 2010-06-15 22:05:35 UTC
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)
Comment 1 Paolo Carlini 2011-10-17 18:10:31 UTC
Already fixed in 4.5.x, 4.6.x and mainline.