Bug 50358 - gcc 2.96 error referencing a variable in its initializer expression in template code
Summary: gcc 2.96 error referencing a variable in its initializer expression in templa...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: gcc
Version: 7.1
Hardware: ia64
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: David Lawrence
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2001-07-30 19:30 UTC by Martin Sebor
Modified: 2007-04-18 16:35 UTC (History)
0 users

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2002-12-15 17:14:52 UTC
Embargoed:


Attachments (Terms of Use)

Description Martin Sebor 2001-07-30 19:30:03 UTC
This fails with 2.96/IA64 as well as 3.0/i86.

Regards
Martin

$ cat t.cpp ; gcc -v t.cpp
template <class T>
int foo (const T&)
{
    int i = foo (i);
    return i;
}

int main ()
{
    foo (0);
}

Reading specs from /package/1/ia64/compilers/gcc-2.96-85/bin/../lib/gcc-lib/ia64-redhat-linux/2.96/specs
gcc version 2.96 20000731 (Red Hat Linux 7.1 2.96-85)
 /package/1/ia64/compilers/gcc-2.96-85/bin/../lib/gcc-lib/ia64-redhat-linux/2.96/cpp0 -lang-c++ -D__GNUG__=2 -D__EXCEPTIONS -v -iprefix 
/package/1/ia64/compilers/gcc-2.96-85/bin/../lib/gcc-lib/ia64-redhat-linux/2.96/ -D__GNUC__=2 -D__GNUC_MINOR__=96 
-D__GNUC_PATCHLEVEL__=0 -D__ia64 -D__ia64__ -D__linux -D__linux__ -D_LONGLONG -Dlinux -Dunix -D__LP64__ -D__ELF__ 
-D__ia64 -D__ia64__ -D__linux -D__linux__ -D_LONGLONG -D__linux__ -D__unix__ -D__LP64__ -D__ELF__ -D__linux -D__unix 
-Asystem(linux) -Acpu(ia64) -Amachine(ia64) -D__NO_INLINE__ -D__LONG_MAX__=9223372036854775807L t.cpp /tmp/ccswYVDP.ii
GNU CPP version 2.96 20000731 (Red Hat Linux 7.1 2.96-85) (cpplib) (IA-64)
#include "..." search starts here:
#include <...> search starts here:
 /package/1/ia64/compilers/gcc-2.96-85/include/g++-3
 /package/1/ia64/compilers/gcc-2.96-85/lib/gcc-lib/ia64-redhat-linux/2.96/include
 /package/1/ia64/compilers/gcc-2.96-85/ia64-redhat-linux/include
 /usr/package/1/compilers/gcc-2.96-85-ia64/include/g++-3
 /usr/package/1/compilers/gcc-2.96-85-ia64/include
 /usr/package/1/compilers/gcc-2.96-85-ia64/lib/gcc-lib/ia64-redhat-linux/2.96/include
 /usr/package/1/compilers/gcc-2.96-85-ia64/ia64-redhat-linux/include
 /usr/include
End of search list.
 /package/1/ia64/compilers/gcc-2.96-85/bin/../lib/gcc-lib/ia64-redhat-linux/2.96/cc1plus /tmp/ccswYVDP.ii -mb-step -quiet -dumpbase t.cpp 
-version -o /tmp/ccMxbeRw.s
GNU C++ version 2.96 20000731 (Red Hat Linux 7.1 2.96-85) (ia64-redhat-linux) compiled by GNU C version 2.96 20000731 (Red Hat Linux 
7.1 2.96-85).
t.cpp: In function `int foo (const T &) [with T = int]':
t.cpp:10:   instantiated from here
t.cpp:4: `i' undeclared (first use this function)
t.cpp:4: (Each undeclared identifier is reported only once for each 
function it appears in.)


Note You need to log in before you can comment on or make changes to this bug.