* Matching on Outer Template Parameters
@ 2004-09-11 5:03 Tyson Whitehead
0 siblings, 0 replies; 3+ messages in thread
From: Tyson Whitehead @ 2004-09-11 5:03 UTC (permalink / raw)
To: gcc
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Matching on Outer Template Parameters
@ 2004-09-12 10:56 Kriang Lerdsuwanakij
0 siblings, 0 replies; 3+ messages in thread
From: Kriang Lerdsuwanakij @ 2004-09-12 10:56 UTC (permalink / raw)
To: gcc; +Cc: twhitehe
Hi
I looked at those bugs before but hadn't come up with a right
fix for this bug. Since then, I worked on another feature to
to meet the GCC 4.0 Stage 2 schedule deadline. It's already
finished and submitted. I will be back to them again in about
2 weeks, after I am back from a trip.
--Kriang
> 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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Matching on Outer Template Parameters
@ 2004-09-11 15:31 Tyson Whitehead
0 siblings, 0 replies; 3+ messages in thread
From: Tyson Whitehead @ 2004-09-11 15:31 UTC (permalink / raw)
To: gcc
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I tried gcc 3.5 this morning, the one provided in the Debian experimental
distribution -- g++-3.5 (GCC) 3.5.0 20040724 (experimental) (Debian
3.5-0pre1). Matching on outer template parameters still does not work (bugs
4882, 13088, and 14032). Again:
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;
}
Bug.cpp:11: error: `type' is not a member of `A<void>::B<void, void>'
The code compiles fine with icc (Intel), cxx (Digital), and apparently Comeau
C/C++.
- -T
PS: As a bit of a side note, bug 13088 did actually contain two different
bugs. The original is a duplicate of bug 4882. The one it picked up with
the nested_deductions code, nested templates not matching on template
template specializations [see original post for vastly simplified code], has
been fixed.
- --
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
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
iD8DBQFBQv9oRXbLmIoqtdgRAjJUAJ4m3Sitx0DjKlk1GmYc37njcnd/HgCgsn2M
0g94MdEpWKBnPSsIkNog4xI=
=3atT
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2004-09-12 3:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-11 5:03 Matching on Outer Template Parameters Tyson Whitehead
2004-09-11 15:31 Tyson Whitehead
2004-09-12 10:56 Kriang Lerdsuwanakij
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).