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]

[C++ PATCH] Fix handling of canonical types for nested BOUND_TEMPLATE_TEMPLATE_PARMS


[C++ patch below]

On 1/4/07, Andrew Pinski <pinskia@physics.uc.edu> wrote:
> > That indicates a bug in the handling of canonical types. If you had
> > compiled with --disable-checking, it would probably ICE or fail to
> > compile tramp3d.
>
> Actually I would expect more ICEs with --enable-checking than wihtout.

In fact this really should have been an ICE instead of an warning.
Even if I add -w, I still get part of the warning out which is annoying.

We could just make it an ICE, rather than a warning, to increase the urgency of errors in the canonical types patch... I'll submit that separately in a few days. I'd like to see if there are any more reports from the warning before we up the ante.

Here is a reduced testcase for the problem:
template<class Mesh> class Field { };
template <int Dim>
struct CentX
{
   template <template <int> class Mesh >
   void df(Field<Mesh<Dim> > );
};
CentX<3> a1;


I thought everyone would love this testcase which is why I am adding it here.

Wonderful, thank you. Turns out that it was a trivial fix in the handling of member templates.

Patch and ChangeLog follow.

Tested i686-pc-linux-gnu; no regressions.

 Cheers,
 Doug

Index: pt.c
===================================================================
--- pt.c        (revision 120438)
+++ pt.c        (working copy)
@@ -7530,6 +7530,8 @@ tsubst (tree t, tree args, tsubst_flags_
                    require structural equality checking to compare
                    TEMPLATE_TEMPLATE_PARMs. */
                 SET_TYPE_STRUCTURAL_EQUALITY (r);
+               else if (TYPE_STRUCTURAL_EQUALITY_P (t))
+                 SET_TYPE_STRUCTURAL_EQUALITY (r);
               else
                 TYPE_CANONICAL (r) = canonical_type_parameter (r);

2007-01-04 Douglas Gregor <doug.gregor@gmail.com>

	* pt.c (tsubst): Propagate the need for structural equality checks
	when reducing the level of template parameters.


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