GCC compilation error for template template parameters
Following simple code:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
template< template< typename > class T1 >
struct OuterType
{
template< typename T2 >
struct InnerType {};
};
template< template< typename > class T >
struct TestType : public OuterType< OuterType< T >::InnerType > {};
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
while being compiled with GCC 3.4.4 (Windows, Cygwin) with no compiler
options produces following error:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gpp.cpp:10: error: type/value mismatch at argument 1 in template
parameter list for `template<template<class> class T1> struct
OuterType'
gpp.cpp:10: error: expected a class template, got
`OuterType<T1>::InnerType'
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
MS VS 2008 for the same code does not generate any error (nor
warning).
Adding "typename" before "OuterType< T >::InnerType" does not change
anything (on both compilers) and seems wrong to me anyway.
Whats wrong with that code? Or is it a bug in GCC?
Adam Badura
--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]