Bug 3 - Nested types sometimes not visible
Summary: Nested types sometimes not visible
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: unknown
: P3 normal
Target Milestone: 3.0.x
Assignee: Nathan Sidwell
URL:
Keywords:
: 2621 3353 3926 (view as bug list)
Depends on:
Blocks:
 
Reported: 1999-08-26 01:26 UTC by Nathan Sidwell
Modified: 2013-07-23 17:42 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nathan Sidwell 1999-08-26 01:26:01 UTC
The qualified version of a nested type is sometimes not visible
during the definition of the containing class. See the example.
this gives
nathan46.C:25: no type named `F' in `struct A'
What appears to be happening is that during the lookup of D::F's base class
`D::Parent::F', `D::Parent' finds `B::Parent' because
the typedef on line 24 has not injected the name into D's scope.
Strangely, C::F is understood as the empty struct C::G defined
just prior appears to cause the name injection.

[I'll submit this independantly to the list, but let's see how
this bug tracker works :-)]

Release:
CVS

Environment:
i686-pc-linux-gnu

How-To-Repeat:
// Copyright (C) 1999 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 25 Aug 1999 <nathan@acm.org>

// typenames are not injected early enough

struct A {
};

struct B : A {
  typedef A Parent;
  struct F {
  };
};

struct C : B {
  typedef B Parent;
  struct G {};
  struct F : C::Parent::F {
    typedef C::Parent::F Parent;
  };
};

struct D : B {
  typedef B Parent;
  struct F : D::Parent::F {
    typedef D::Parent::F Parent;
  };
};
Comment 1 Nathan Sidwell 2000-11-24 02:43:17 UTC
State-Changed-From-To: open->analyzed
State-Changed-Why: confirmed as a bug
Comment 2 Nathan Sidwell 2000-11-24 10:43:18 UTC
From: nathan@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org, nathan@acm.org, nobody@gcc.gnu.org
Cc:  
Subject: Re: c++/3
Date: 24 Nov 2000 10:43:18 -0000

 Synopsis: Nested types sometimes not visible
 
 State-Changed-From-To: open->analyzed
 State-Changed-By: nathan
 State-Changed-When: Fri Nov 24 02:43:17 2000
 State-Changed-Why:
     confirmed as a bug
 
 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=3&database=gcc
Comment 3 Nathan Sidwell 2000-11-27 00:47:51 UTC
Responsible-Changed-From-To: unassigned->nathan
Responsible-Changed-Why: patch in progress
Comment 4 Nathan Sidwell 2000-11-27 08:47:51 UTC
From: nathan@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org, nathan@acm.org, nathan@gcc.gnu.org,
  nobody@gcc.gnu.org
Cc:  
Subject: Re: c++/3
Date: 27 Nov 2000 08:47:51 -0000

 Synopsis: Nested types sometimes not visible
 
 Responsible-Changed-From-To: unassigned->nathan
 Responsible-Changed-By: nathan
 Responsible-Changed-When: Mon Nov 27 00:47:51 2000
 Responsible-Changed-Why:
     patch in progress
 
 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=3&database=gcc
Comment 5 Nathan Sidwell 2001-01-08 03:34:04 UTC
State-Changed-From-To: analyzed->closed
State-Changed-Why: 2001-01-08  Nathan Sidwell  <nathan@codesourcery.com>
    
            * decl.c (struct binding_level): Adjust class_shadowed comments
            to reflect reality.
            (push_class_level_binding): Ajust comments to reflect reality.
            Set IDENTIFIER_CLASS_VALUE when replacing an existing binding.
            Don't set TREE_VALUE on the class_shadowed list.
Comment 6 Nathan Sidwell 2001-01-08 11:34:04 UTC
From: nathan@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org, nathan@acm.org, nathan@gcc.gnu.org
Cc:  
Subject: Re: c++/3
Date: 8 Jan 2001 11:34:04 -0000

 Synopsis: Nested types sometimes not visible
 
 State-Changed-From-To: analyzed->closed
 State-Changed-By: nathan
 State-Changed-When: Mon Jan  8 03:34:04 2001
 State-Changed-Why:
     2001-01-08  Nathan Sidwell  <nathan@codesourcery.com>
     
             * decl.c (struct binding_level): Adjust class_shadowed comments
             to reflect reality.
             (push_class_level_binding): Ajust comments to reflect reality.
             Set IDENTIFIER_CLASS_VALUE when replacing an existing binding.
             Don't set TREE_VALUE on the class_shadowed list.
 
 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=3&database=gcc
Comment 7 gnu.andrew 2013-07-23 16:00:41 UTC Comment hidden (obsolete)
Comment 8 Robert Lougher 2013-07-23 17:42:01 UTC Comment hidden (obsolete)