Matching on Outer Template Parameters
Tyson Whitehead
twhitehe@uwo.ca
Sat Sep 11 05:03:00 GMT 2004
There appear to be three separate bug reports now about gcc (up to and
including 3.4.2) not matching specializations that depend on outer template
parameters (unlike icc (Intel), cxx (Digital), and Comeasu C/C++).
The original bug report (4882), which has been verified, appears to have been
submitted in Nov 2001. I would be extremely grateful if someone could get
this problem resolved!
Thanks -T
PS: I wasn't sure if I should post this to gcc-bugs list or the gcc list.
Sorry if it should have been the latter. I went with this one because former
appeared to be for automatic Bugzilla posts.
----
4882 -- The original 2001 bug report. Specializations that depend on outer
template parameters are not matched. The following is about the simplest
code you can get to demonstrate it:
template<typename t>
struct A {
template<typename,typename>
struct B { };
template<typename d>
struct B<t,d> { typedef int type; };
};
int main(){
A<void>::B<void,void>::type val = 0;
return val;
}
It compiles fine on cxx (Digital), icc (Intel), and apparently Comeau C/C++
(see original bug report). With g++-3.4 (and earlier) you get:
Bug.cpp:11: error: `type' is not a member of `A<void>::B<void,void>'
----
13088 -- There actually seems to be two (probably different) bugs here.
The original bug (which I'm assuming is accurately summarized in comment four)
exhibits the same problem as above. The specialization of the Local
structure that is not matched (see comment four) depends on the outer
structure X's template paramater U. Precisely bug 4882.
The nested_deduction.zip source, which was submitted much later, demonstrates
a different problems. Nested templates don't match on template template
specializations. A vastly simplified (over the submitted nested_deductions
code) example is:
template<typename>
struct A {
template<typename>
struct B { };
};
template<typename>
struct C { };
template<template<typename> class c,typename t>
struct C<c<t> > {
typedef int type;
};
int main(void) {
C<A<void> >::type val0 = 0;
C<A<void>::B<void> >::type val1 = 0;
return val0+val1;
}
It compiles fine on cxx (Digital) and icc (Intel) (don't know about Comeau
C/C++). With g++-3.4 (and earlier) you get:
Simplified.cpp:17: error: `type' is not a member of type `C<A<void>::B<void>
>'
----
14032 -- Same as 4882 (but uses bools as template parameters instead of
typenames).
--
Tyson Whitehead (-twhitehe@uwo.ca -- WSC-)
Computer Engineer Dept. of Applied Mathematics,
Graduate Student- Applied Mathematics University of Western Ontario,
GnuPG Key ID# 0x8A2AB5D8 London, Ontario, Canada
More information about the Gcc
mailing list