This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: C++:default template arguments for template specialization(was:Fix for bug 68)
- To: kaa at comail dot ru
- Subject: Re: C++:default template arguments for template specialization(was:Fix for bug 68)
- From: Kriang Lerdsuwanakij <lerdsuwa at solar dot usc dot edu>
- Date: Sun, 7 Jan 2001 21:08:10 -0800 (PST)
- cc: gcc-bugs at gcc dot gnu dot org
Hi
Thanks for the bug report and detailed analysis. I'm now
investigating this problem and working for a fix.
--Kriang
> Hi all,
>
> This is for gcc-20001225.
>
> There is something wrong with this patch:
>
> 2000-12-14 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
>
> * pt.c (check_explicit_specialization): Propagate default
> function arguments to explicit specializations.
>
>
> Looking at the tree dump for the testcase, I see that argument type
> nodes for an unsigned
> argument are shared between vector::vector(unsigned) and explicit
instantiation for
> messages_byname<char>::messages_byname(char const*, unsigned).
>
> Apparently the code
> + if (TREE_PURPOSE (t2))
> + TREE_PURPOSE (t1) = TREE_PURPOSE (t2);
>
> sets default argument value to all such shared tree nodes, so
> vector::vector(unsigned) now "inherits"
> default value from the primary template for
> messages_byname::messages_byname(char const*, unsigned),
> and becomes ambiguous with default vector constructor.
>
> Hope this is useful,
> Artem.