This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Insufficient access check for private static member in base class
- From: Ian Lance Taylor <iant at google dot com>
- To: "Peter A. Felvegi" <petschy at praire-chicken dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Fri, 18 May 2012 06:34:19 -0700
- Subject: Re: Insufficient access check for private static member in base class
- References: <4FB63BA0.9000003@praire-chicken.com>
"Peter A. Felvegi" <petschy@praire-chicken.com> writes:
> All versions I've tried (4.4, 4.5, 4.6, 4.7) compiles the code. clang
> gives proper diagnostic stating that Base::foo is private.
>
> If base::foo is not static, gcc catches the error, too:
> gccacbug.cpp: In member function âint DerivT<T>::Foo() [with T = void]â:
> gccacbug.cpp:25: instantiated from here
> gccacbug.cpp:4: error: âint Base::fooâ is private
> gccacbug.cpp:19: error: within this context
>
> If I enable the non-templated Deriv class, I get an error (twice):
> gccacbug.cpp: In member function âint Deriv::Foo()â:
> gccacbug.cpp:3:13: error: âint Base::fooâ is private
> gccacbug.cpp:10:21: error: within this context
> gccacbug.cpp:3:13: error: âint Base::fooâ is private
> gccacbug.cpp:10:21: error: within this context
>
> Searching bugzilla for 'static member access' didn't give any
> results. Should I file a bug report?
Looks like an instance of http://gcc.gnu.org/PR16617 ,
http://gcc.gnu.org/PR47346 , http://gcc.gnu.org/PR48078 , and friends.
Ian