c++/9190: [3.4 regression] Access control looks for names the wrong way

bangerth@ticam.utexas.edu bangerth@ticam.utexas.edu
Mon Jan 13 05:17:00 GMT 2003


>Number:         9190
>Category:       c++
>Synopsis:       [3.4 regression] Access control looks for names the wrong way
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Jan 06 07:46:02 PST 2003
>Closed-Date:
>Last-Modified:
>Originator:     Wolfgang Bangerth
>Release:        unknown-1.0
>Organization:
>Environment:
Present CVS
>Description:
This file
---------------------------
template <int N> class B {
  protected:
    struct Inner {
        static int f();
    };
};

template <int N> class D : public B<N> {
  void f() { B<N>::Inner::f(); };
};
-----------------------------used to compile, but now yields
  tmp/g> /home/bangerth/bin/gcc-3.4-pre/bin/c++ -o /dev/null -c bug3.cc
  bug3.cc: In member function `void D<N>::f()':
  bug3.cc:3: error: `struct B<N>::Inner' is protected
  bug3.cc:9: error: within this context

I think this is wrong, since name lookup of B<N>::Inner
should happen from within the inheritance hierarchy, not
go outside.

The bug is kind of fragile: if I remove any template args,
or make Inner::f a static variable instead of a function,
then everything compiles fine. This is strange...

Regards
  Wolfgang
>How-To-Repeat:

>Fix:

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



More information about the Gcc-bugs mailing list