This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

preprocessor/3864: #line directive/template interaction produces wrong file name on errors

>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
>Release:        gcc 3.0
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.


--------- start test.cpp
template <class T>
void doit(T arg) {
#line 20 "somefile.x"
        T local = args;

main() {
        double arg;
--------- end test.cpp

Output message:

g++ -v test.cpp
Reading specs from
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
#include "..." search starts here:
#include <...> search starts here:

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.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]