Bug 66541 - unexpected error report: "var was not declared in this scope"
Summary: unexpected error report: "var was not declared in this scope"
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: gcc   
(Show other bugs)
Version: 8.0
Hardware: i386 Linux
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Brian Brock
Depends On:
TreeView+ depends on / blocked
Reported: 2002-06-11 22:17 UTC by Rafal Dabrowa
Modified: 2007-04-18 16:43 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2004-10-02 20:57:40 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

Description Rafal Dabrowa 2002-06-11 22:17:21 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)

Description of problem:
The following code results with compiler error report "var was not declared in 
this scope":
template <class T> void doit( T var ) {
    struct st { int i; char s[sizeof(var)]; } zz;

int main() { doit(3); }

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. Copy program from description
2. compile using g++

Actual Results:  bug1.cc: In instantiation of `doit (T) [with T = int]::st':
bug1.cc:4:   instantiated from `doit (T) [with T = int]'
bug1.cc:9:   instantiated from here
bug1.cc:4: `var' was not declared in this scope

Expected Results:  Variable var is a "doit" function parameter.

Additional info:

Comment 1 Alan Cox 2002-12-15 21:38:10 UTC
verified stil true in g++ 3.2 

Comment 2 Richard Henderson 2004-10-02 20:57:40 UTC
Fixed during the 3.4 release cycle.  Fails in 3.4 20030425,
fixed in 3.4.3 20041001.

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