This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: c++/8389: [mainline regression] Access to members of base class & templates
- From: bangerth at dealii dot org
- To: dv at vollmann dot ch, gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, nobody at gcc dot gnu dot org
- Date: 29 Oct 2002 15:39:16 -0000
- Subject: Re: c++/8389: [mainline regression] Access to members of base class & templates
- Reply-to: bangerth at dealii dot org, dv at vollmann dot ch, gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, nobody at gcc dot gnu dot org, gcc-gnats at gcc dot gnu dot org
Old Synopsis: Cannot access protected member in base class
New Synopsis: [mainline regression] Access to members of base class & templates
State-Changed-From-To: open->analyzed
State-Changed-By: bangerth
State-Changed-When: Tue Oct 29 07:39:14 2002
State-Changed-Why:
Confirmed. It works in 3.2.1pre, though. The shortest example
I can come up with is this:
----------------------------------
template <class>
class Base {
protected:
typedef int Type;
};
template <class T>
struct Derived : public Base<T> {
typedef typename Base<T>::Type Type;
template <class Arg>
void f(Type = Type()) {};
};
template void Derived<char>::f<int> (Type);
-----------------------------------
Making one of the templates a non-template makes the bug
go away. What is also surprising is the three-fold output
gcc gives:
--------------------------------------
tmp/g> /home/bangerth/bin/gcc-3.3-pre/bin/c++ -ansi -pedantic -W -Wall -c x.cc
x.cc:4: error: `typedef int Base<char>::Type' is protected
x.cc:12: error: within this context
x.cc:4: error: `typedef int Base<char>::Type' is protected
x.cc:12: error: within this context
x.cc:4: error: `typedef int Base<char>::Type' is protected
x.cc:15: error: within this context
--------------------------------------
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8389