> /dept/rnd/vendor/gcc-4.0.0pre1-amd64/bin/g++ -c bug.C -o /dev/null
bug.C: In member function 'int B::Foo::foo()':
bug.C:9: error: 'int B::Foo::Bar::v' is protected
bug.C:12: error: within this context

> /dept/rnd/vendor/gcc-4.0.0pre1-amd64/bin/g++ -v
Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-4.0.0-20050410/configure --enable-languages=c,c++
--prefix=/dept/rnd/vendor/gcc-4.0.0-20050410-amd64 --enable-threads
Thread model: posix
gcc version 4.0.0 20050410 (prerelease)

> cat bug.C 
namespace A { struct Foo {}; }
namespace B {
struct Foo : public A::Foo
{
  public:
    struct Bar {
        friend struct Foo;
      protected:
        int v;
    };
    Bar bar;
    int foo () { return bar.v; }
};
}

I believe that friend struct Foo should refer to B::Foo
but it seems to instead refer to A::Foo.  This code compiles
correctly on gcc-3.4.1.

-- 
           Summary: [4.0 regression] incorrect name lookup from nested
                    struct
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: nick at ilm dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: x86_64-unknown-linux-gnu
  GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21012

Reply via email to