This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/20028] [3.4 Regression] class and then template class gives an ICE
- From: "jcobyrne at cox dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 17 Feb 2005 21:09:06 -0000
- Subject: [Bug c++/20028] [3.4 Regression] class and then template class gives an ICE
- References: <20050217160539.20028.jcobyrne@cox.net>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From jcobyrne at cox dot net 2005-02-17 21:09 -------
(In reply to comment #4)
> Patch here: <http://gcc.gnu.org/ml/gcc-patches/2005-02/msg01020.html> for
3.4.x.
The following code _IS_ correct and _DOES_ compile on 3.2.
template <class T> class A
{ protected: typedef T someType; };
template <class T> class B
{ protected: typedef T anotherType; };
// we should be able to access protected members of classes X and Y here,
// because we are inheriting them.
template <typename T, template <class> class X, template <class> class Y>
class Foo : public X <T>, public Y <typename X<T>::someType>
{ typedef Y<typename X<T>::someType> yetAnotherType; };
int main ()
{ Foo<int, A, B> x; return 0; }
-----------
I guess I stumbled on the segfault by mistake in my vain attempts to get the
code to compile on 3.3 and greater. Syntactically and semantically, I have
confirmed that this code does work, and it is also used similarly in
Alexandrescu's book on C++ Design Patterns.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20028