This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c++/7008: unexpected error message "var was not declared in this scope"
- From: rdabrowa at poczta dot onet dot pl
- To: gcc-gnats at gcc dot gnu dot org
- Date: 12 Jun 2002 20:11:40 -0000
- Subject: c++/7008: unexpected error message "var was not declared in this scope"
- Reply-to: rdabrowa at poczta dot onet dot pl
>Number: 7008
>Category: c++
>Synopsis: unexpected error message "var was not declared in this scope"
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: unassigned
>State: open
>Class: rejects-legal
>Submitter-Id: net
>Arrival-Date: Wed Jun 12 13:16:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: Rafal Dabrowa
>Release: gcc-3.1
>Organization:
>Environment:
>Description:
Below is simple program, which demonstrates problem.
During compile, unexpected error message appears:
bug1.cc: In instantiation of `doit(T) [with T = int]::st':
bug1.cc:5: instantiated from `void doit(T) [with T = int]'
bug1.cc:10: instantiated from here
bug1.cc:5: `var' was not declared in this scope
This bug occurs in gcc-2.96 and some earlier versions, too.
(I have it submitted to RedHat bugzilla as a gcc-2.96 bug)
>How-To-Repeat:
Please compile code specified below using g++:
template <class T> void doit( T var )
{
struct st { int i; char s[sizeof(var)]; } zz;
}
int main() { doit(3); }
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: