This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Require canonical type comparison for typedefs again.
On 10/20/2010 05:37 PM, Dodji Seketeli wrote:
+ /* Only substitute into template non-type parms. */
+ if (parameter != NULL_TREE
+ && TREE_CODE (parameter) == TREE_LIST
+ && (TREE_CODE (TREE_VALUE (parameter)) == TYPE_DECL
+ || TREE_CODE (TREE_VALUE (parameter)) == TEMPLATE_DECL))
+ continue;
+
+ if (!dependent_type_p (TREE_TYPE (TREE_VALUE (parameter))))
+ continue;
These optimizations seem unsafe:
template <class T, template <class U = T> class V> ...
template <class T, template <int I = T()> class U> ...
Let's handle all parms, and check in fixup_template_parm* to see if a
parm has the right NUM_SIBLINGS before we try to adjust it; I would
expect that the parms of a template template parm will already have
NUM_SIBLINGS set properly, we just need to substitute in the outer parms.
+ Consider the level of the parms of TT; T and U both have
+ level 2; TT has no template parm of level 1. So in this case
+ the first element of full_template_args is NULL_TREE. If we
+ leave it like this TMPL_ARG_DEPTH on args returns 1 instead
+ of 2. This will make tsubst wrongly consider that T and U
+ have level 1. Instead, let's create a dummy vector as the
+ first element of full_template_args so that TMPL_ARG_DEPTH
+ returns the correct depth for args.
+ */
The */ should go on the last line of text, not on a line by itself.
Jason