Bug 66541 - unexpected error report: "var was not declared in this scope"
unexpected error report: "var was not declared in this scope"
Product: Red Hat Linux
Classification: Retired
Component: gcc (Show other bugs)
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
Brian Brock
Depends On:
  Show dependency treegraph
Reported: 2002-06-11 18:17 EDT by Rafal Dabrowa
Modified: 2007-04-18 12:43 EDT (History)
0 users

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

Attachments (Terms of Use)

  None (edit)
Description Rafal Dabrowa 2002-06-11 18:17:21 EDT
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 16:38:10 EST
verified stil true in g++ 3.2 
Comment 2 Richard Henderson 2004-10-02 16:57:40 EDT
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.