This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
preprocessor/3864: #line directive/template interaction produces wrong file name on errors
- To: gcc-gnats at gcc dot gnu dot org
- Subject: preprocessor/3864: #line directive/template interaction produces wrong file name on errors
- From: ecohen at angeles dot com
- Date: 29 Jul 2001 05:34:28 -0000
- Reply-To: ecohen at angeles dot com
>Number: 3864
>Category: preprocessor
>Synopsis: #line directive/template interaction produces wrong file name on errors
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sat Jul 28 22:36:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator: ecohen@angeles.com
>Release: gcc 3.0
>Organization:
>Environment:
sparc-sun-solaris2.7
>Description:
Specifying a line number and file using the #line directive within a template which causes an error results in the correct (new) line number but the incorrect (old) filename.
File:
--------- start test.cpp
template <class T>
void doit(T arg) {
#line 20 "somefile.x"
T local = args;
}
main() {
double arg;
doit(arg);
}
--------- end test.cpp
Output message:
g++ -v test.cpp
Reading specs from
/disk3/users/ecohen/GNU/INSTALL/sol2/lib/gcc-lib/sparc-sun-solaris2.7/3.0/specs
Configured with:
../gcc-3.0/configure --prefix=/disk3/users/ecohen/GNU/INSTALL/sol2 --with-gnu-as --with-gnu-ld
Thread model: posix
gcc version 3.0
/disk3/users/ecohen/GNU/INSTALL/sol2/lib/gcc-lib/sparc-sun-solaris2.7/3.0/cc1plus -v -D__GNUC__=3 -D__GNUC_MINOR__=0 -D__GNUC_PATCHLEVEL__=0 -Dsparc -Dsun -Dunix -D__svr4__ -D__SVR4 -D__sparc__ -D__sun__ -D__unix__ -D__svr4__ -D__SVR4 -D__sparc -D__sun -D__unix -Asystem=unix -Asystem=svr4 -D__NO_INLINE__ -D__STDC_HOSTED__=1 -D_XOPEN_SOURCE=500 -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 -D__EXTENSIONS__ -D__GCC_NEW_VARARGS__ -Acpu=sparc -Amachine=sparc
test.cpp -D__GNUG__=3 -D__GXX_DEPRECATED -D__EXCEPTIONS -D__GXX_ABI_VERSION=100 -quiet -dumpbase test.cpp -version -o /var/tmp/cc9bAsBh.s
GNU CPP version 3.0 (cpplib) (sparc)
GNU C++ version 3.0 (sparc-sun-solaris2.7)
compiled by GNU C version 3.0.
ignoring nonexistent directory
"/disk3/users/ecohen/GNU/INSTALL/sol2/sparc-sun-solaris2.7/include"
#include "..." search starts here:
#include <...> search starts here:
/disk3/users/ecohen/GNU/INSTALL/sol2/include/g++-v3
/disk3/users/ecohen/GNU/INSTALL/sol2/include/g++-v3/sparc-sun-solaris2.7
/disk3/users/ecohen/GNU/INSTALL/sol2/include/g++-v3/backward
/usr/local/include
/disk3/users/ecohen/GNU/INSTALL/sol2/lib/gcc-lib/sparc-sun-solaris2.7/3.0/include
/usr/include
End of search list.
test.cpp: In function `void doit(T) [with T = double]':
somefile.x:25: instantiated from here
test.cpp:20: `args' undeclared (first use this function)
test.cpp:20: (Each undeclared identifier is reported only once for each function it appears in.)
The message indicates "test.cpp:20" it should be "somefile.x:20" - the line number is correct but the file name is incorrect.
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: