* Re: problems with partial specialization of templates with template parameters
1998-02-18 14:54 problems with partial specialization of templates with template parameters Andrey Slepuhin
@ 1998-02-18 14:54 ` Kriang Lerdsuwanakij
1998-02-18 23:56 ` Patch for " Kriang Lerdsuwanakij
1 sibling, 0 replies; 3+ messages in thread
From: Kriang Lerdsuwanakij @ 1998-02-18 14:54 UTC (permalink / raw)
To: Andrey Slepuhin; +Cc: egcs, Kriang Lerdsuwanakij, Mark Mitchell
On Wed, 18 Feb 1998, Andrey Slepuhin wrote:
> Hi,
> I have problems with partial specialization of templates
> with template parameters. I.e., trying to compile the following
> example:
> ----------------------------------------------
> template <class T, template <class T> class C>
> struct X
> {};
>
> template <class T>
> struct Y
> {};
>
> template <class T>
> struct Z
> {};
>
> template <class T>
> struct X<T,Y>
> {};
>
> void main()
> {
> X<int,Y> a;
> X<int,Z> b;
> }
> -----------------------------------------------
> I got with egcs-980205:
> -----------------------------------------------
> tmp1.cc:20: sorry, not implemented: use of `template_decl' in template type
> unification
> -----------------------------------------------
> Removing definition of X<T,Y> all works Ok. Also all works, if
> I remove "X<int,Z> b;" line (strange, isn't?). Is something
> really not implemented? Do I use invalid syntax? Or this is
> a bug? Any help is appreciated.
>
> Regards,
> Andrey.
>
>
Thanks for the report. It's a bug. It tries to match X<int,Z> against
X<T,Y> and dies with the error message. I'll post a patch for this.
--Kriang
^ permalink raw reply [flat|nested] 3+ messages in thread
* problems with partial specialization of templates with template parameters
@ 1998-02-18 14:54 Andrey Slepuhin
1998-02-18 14:54 ` Kriang Lerdsuwanakij
1998-02-18 23:56 ` Patch for " Kriang Lerdsuwanakij
0 siblings, 2 replies; 3+ messages in thread
From: Andrey Slepuhin @ 1998-02-18 14:54 UTC (permalink / raw)
To: egcs; +Cc: Kriang Lerdsuwanakij, Mark Mitchell
Hi,
I have problems with partial specialization of templates
with template parameters. I.e., trying to compile the following
example:
----------------------------------------------
template <class T, template <class T> class C>
struct X
{};
template <class T>
struct Y
{};
template <class T>
struct Z
{};
template <class T>
struct X<T,Y>
{};
void main()
{
X<int,Y> a;
X<int,Z> b;
}
-----------------------------------------------
I got with egcs-980205:
-----------------------------------------------
tmp1.cc:20: sorry, not implemented: use of `template_decl' in template type
unification
-----------------------------------------------
Removing definition of X<T,Y> all works Ok. Also all works, if
I remove "X<int,Z> b;" line (strange, isn't?). Is something
really not implemented? Do I use invalid syntax? Or this is
a bug? Any help is appreciated.
Regards,
Andrey.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Patch for problems with partial specialization of templates with template parameters
1998-02-18 14:54 problems with partial specialization of templates with template parameters Andrey Slepuhin
1998-02-18 14:54 ` Kriang Lerdsuwanakij
@ 1998-02-18 23:56 ` Kriang Lerdsuwanakij
1 sibling, 0 replies; 3+ messages in thread
From: Kriang Lerdsuwanakij @ 1998-02-18 23:56 UTC (permalink / raw)
To: egcs; +Cc: Mark Mitchell, Andrey Slepuhin
Hi
Here is the patch that fix the partial specialization bug reported
earlier.
Kriang
=======================================================
* pt.c (unify): Handle TEMPLATE_DECL.
diff -rNpc gcc-old/cp/pt.c gcc/cp/pt.c
*** gcc-old/cp/pt.c Wed Feb 18 16:24:52 1998
--- gcc/cp/pt.c Wed Feb 18 16:24:03 1998
*************** unify (tparms, targs, ntparms, parm, arg
*** 5218,5223 ****
--- 5218,5227 ----
return 1;
return 0;
+ case TEMPLATE_DECL:
+ /* Matched cases are handled by the ARG == PARM test above. */
+ return 1;
+
default:
sorry ("use of `%s' in template type unification",
tree_code_name [(int) TREE_CODE (parm)]);
diff -rNpc gcc-old/testsuite/g++.old-deja/g++.pt/ttp42.C
gcc/testsuite/g++.old-deja/g++.pt/ttp42.C
*** gcc-old/testsuite/g++.old-deja/g++.pt/ttp42.C Wed Dec 31 16:00:00
1969
--- gcc/testsuite/g++.old-deja/g++.pt/ttp42.C Wed Feb 18 16:26:33 1998
***************
*** 0 ****
--- 1,21 ----
+ template <class T, template <class T> class C>
+ struct X
+ {};
+
+ template <class T>
+ struct Y
+ {};
+
+ template <class T>
+ struct Z
+ {};
+
+ template <class T>
+ struct X<T,Y>
+ {};
+
+ int main()
+ {
+ X<int,Y> a;
+ X<int,Z> b;
+ }
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~1998-02-18 23:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-02-18 14:54 problems with partial specialization of templates with template parameters Andrey Slepuhin
1998-02-18 14:54 ` Kriang Lerdsuwanakij
1998-02-18 23:56 ` Patch for " 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).