Bug 66541

Summary: unexpected error report: "var was not declared in this scope"
Product: [Retired] Red Hat Linux Reporter: Rafal Dabrowa <rdabrowa>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED RAWHIDE QA Contact: Brian Brock <bbrock>
Severity: medium Docs Contact:
Priority: medium    
Version: 8.0   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2004-10-02 20:57:40 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

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:
Always

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

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.