Bug#269513: gcc-3.4: Template template specialization matching problem.
Package: gcc-3.4
Version: 3.4.1-7
Severity: normal
Gcc 3.3 and gcc 3.4 both give the error message "error: `type' is not
a member of `outer<dummy>::inner<dummy<int> >'" when trying to compile
the following:
template<typename dummy_var>
struct dummy { };
template<template<typename> class outer_func>
struct outer {
template<typename inner_var>
struct inner { };
template<typename dummy_var>
struct inner<outer_func<dummy_var> > { typedef dummy_var type; };
};
int main(){
outer<dummy>::inner<dummy<int> >::type var = 0;
return var;
}
Both cxx (Digital's compiler) and icc (Intel's compiler) have no such
problem. It appears that gcc does not properly match against the
specialized inner struct in this case (i.e. it fails to match when the
specialized parameter is based on a template template parameter of an
enclosing struct).
-T
PS: Note that the following version (which contains an even more
explicit specialization) also does not work with gcc (and also does
work with both cxx and icc):
template<template<typename> class outer_func>
struct outer {
template<typename inner_var, typename dummy=void>
struct inner { };
template<typename dummy>
struct inner<outer_func<int>,dummy> { typedef int type; };
};
-- System Information:
Debian Release: 3.1
APT prefers unstable
APT policy: (500, 'unstable')
Architecture: alpha
Kernel: Linux 2.6.6
Locale: LANG=C, LC_CTYPE=C
Versions of packages gcc-3.4 depends on:
ii binutils 2.15-1 The GNU assembler, linker and bina
ii cpp-3.4 3.4.1-7 The GNU C preprocessor
ii gcc-3.4-base 3.4.1-7 The GNU Compiler Collection (base
ii libc6.1 2.3.2.ds1-16 GNU C Library: Shared libraries an
ii libgcc1 1:3.4.1-7 GCC support library
-- no debconf information
Reply to: