c++/3: Nested types sometimes not visible

nathan@acm.org nathan@acm.org
Thu Aug 26 01:26:00 GMT 1999


>Number:         3
>Category:       c++
>Synopsis:       Nested types sometimes not visible
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Aug 26 01:26:01 PDT 1999
>Closed-Date:
>Last-Modified:
>Originator:     nathan@acm.org
>Release:        CVS
>Organization:
>Environment:
i686-pc-linux-gnu
>Description:
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 :-)]
>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;
  };
};
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the Gcc-prs mailing list