C++:default template arguments for template specialization(was:Fix for bug 68)

Kriang Lerdsuwanakij lerdsuwa@solar.usc.edu
Sun Jan 7 21:08:00 GMT 2001


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.






More information about the Gcc-bugs mailing list