This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/21008] [3.4/4.0/4.1 Regression] Acess failure in accessing data member of base class from derived template class
- From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 13 Apr 2005 22:04:16 -0000
- Subject: [Bug c++/21008] [3.4/4.0/4.1 Regression] Acess failure in accessing data member of base class from derived template class
- References: <20050413215022.21008.nicoara@roguewave.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-04-13 22:04 -------
Ok, I don't know if this is valid code (I think it is invalid as foo_ is qualified and not dependent, even
though ICC and Comeau does not reject this):
struct A { int foo_; };
template <class T> struct B : public A {};
template<> struct B<int> {};
template <class T>
struct C : B<T>
{
int foo () {
return A::foo_;
}
};
Take the above code and add:
C<int> a;
void f(void) {a.foo();}
ICC only rejects the code at instantiation time which seems wrong.
Someone else will have to comment to make sure that I got my analysis right.
The way to "fix" the if the code is invalid is to do B<T>::A::_foo or this->_foo.
--
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |rejects-valid
Summary|Acess failure in accessing |[3.4/4.0/4.1 Regression]
|data member of base class |Acess failure in accessing
|from derived template class |data member of base class
| |from derived template class
Target Milestone|--- |3.4.4
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21008