This is the mail archive of the gcc-patches@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]
Other format: [Raw text]

Re: [C++ PATCH] Fix unification of template template parameters (PRs 32565, 33943, 33965)


Doug Gregor wrote:
+	    /* The template parameter is something like TT<T> and the
+	       template argument is something like X<A>.  Verify that
+	       the template argument list of the template argument
+	       (<T>) is compatible with the template argument list of
+	       the template parameter (<A>).  This check is only an
+	       initial check to determine feasibility of the
+	       arguments; an exact check to determine whether it is
+	       permitted to bind the template template parameter
+	       (e.g., 'TT') to the template in the template argument
+	       (e.g., 'X') will be handled by
+	       template_template_parm_bindings_ok_p after all template
+	       arguments have been deduced.  */

In ttp25-27.C, TT<T> and X<A> are C<5> and X<5>, i.e. function parameter/argument, not template parameter/argument. And you're checking to see if the template arguments <5> of X<5> are compatible with the template parameter list <T t> of C<t>. Right?


It seems to me that it would be more appropriate to unify the template parameter lists for TT and X, rather than one parameter list and one argument list. That way we when we compare C<5> to X<5> we would first compare C<T> to X<int> and deduce 'int' for T, so we shouldn't need template_template_parm_bindings_ok_p; deduction would then fail because we deduce 'int' from X<5> and 'long' from 5l, which don't match.

This seems like a hole in the standard that ought to become a core issue: the standard doesn't say that you can deduce a type from a non-type template parameter of a template template argument, nor does it say that it is a nondeduced context. I think this example is a strong argument for doing the deduction.

Could you combine ttp25-27.C into one test? I think that would be clearer.

Jason


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