gcc rejects qualified, dependent template names in templates
Paul Burchard
burchard@pobox.com
Thu Sep 30 19:57:00 GMT 1999
Although it doesn't affect the problem I was reporting, there was an
obvious missing `typename' in the code. Here is the corrected test
case:
template<template<class> class F> struct bind_int {
typedef F<int> type;
};
template<class C> struct bind_int_member {
typedef typename bind_int<C::tmpl>::type type;
};
struct X {
template<class T> struct tmpl {
};
};
int main() {
// Same as: X::tmpl<int> x;
bind_int_member<X>::type x;
}
Reading specs from /usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.1/specs
gcc driver version 2.96 19990913 (experimental) executing gcc version
2.95.1
/usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.1/cpp -lang-c++ -v
-D__GNUC__=2 -D__GNUG__=2 -D__GNUC_MINOR__=95 -D__cplusplus -D__ELF__
-Dunix -D__i386__ -Dlinux -D__ELF__ -D__unix__ -D__i386__ -D__linux__
-D__unix -D__linux -Asystem(posix) -D__EXCEPTIONS -Acpu(i386)
-Amachine(i386) -Di386 -D__i386 -D__i386__ -Di686 -Dpentiumpro -D__i686
-D__i686__ -D__pentiumpro -D__pentiumpro__ qualdep__1.C /tmp/ccClJeOR.ii
GNU CPP version 2.95.1 19990816 (release) (i386 Linux/ELF)
#include "..." search starts here:
#include <...> search starts here:
/usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.1/../../../../include/g++-3
/usr/local/include
/usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.1/../../../../i686-pc-linux-gnu/include
/usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.1/include
/usr/include
End of search list.
The following default directories have been omitted from the search
path:
End of omitted list.
/usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.1/cc1plus
/tmp/ccClJeOR.ii -quiet -dumpbase qualdep__1.cc -version -o
/tmp/cce0G1ZA.s
GNU C++ version 2.95.1 19990816 (release) (i686-pc-linux-gnu) compiled
by GNU C version 2.95.1 19990816 (release).
qualdep__1.C:6: to refer to a type member of a template parameter,
qualdep__1.C:6: use `typename C::tmpl'
qualdep__1.C:6: type/value mismatch at argument 1 in template parameter
list for `template <template <class> F> bind_int<F>'
qualdep__1.C:6: expected a class template, got `typename C::tmpl'
qualdep__1.C:6: `type' is not a class or namespace
qualdep__1.C:6: ANSI C++ forbids declaration `type' with no type
--
----------------------------------------------------------------------
Paul Burchard <burchard@pobox.com> http://www.pobox.com/~burchard/
----------------------------------------------------------------------
More information about the Gcc-bugs
mailing list