This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

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


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.





Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]