This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/20028] [3.4 Regression] class and then template class gives an ICE


------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]