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] [PR14284] A template template parameter is a dependent type (regression 3.4/trunk)


Hello,

this regression is a fallout of Mark's patch to uses_template_parms. It turns
out that dependent_type_p_r was forgetting to acknowledge a
TEMPLATE_TEMPLATE_PARM as a dependent type. Making it nondependent was
preventing unification from working correctly, thus causing a failure in
selection in partial ordering of partial specializations. Before,
uses_template_parms was returning true on such a type.

Tested on i686-pc-linux-gnu, with no new regressions. OK for 3.4 and mainline?

Giovanni Bajo


2004-02-26  Giovanni Bajo  <giovannibajo@gcc.gnu.org>

        PR c++/14284
        * pt.c (dependent_type_p_r): A template template parameter is a
        dependent type.


2004-02-26  Giovanni Bajo  <giovannibajo@gcc.gnu.org>

        PR c++/14284
        * g++.dg/template/ttp8.C: New test.



Index: pt.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/pt.c,v
retrieving revision 1.830
diff -c -3 -p -r1.830 pt.c
*** pt.c 14 Feb 2004 11:28:59 -0000 1.830
--- pt.c 26 Feb 2004 14:03:55 -0000
*************** dependent_type_p_r (tree type)
*** 11541,11547 ****
       A type is dependent if it is:

       -- a template parameter.  */
!   if (TREE_CODE (type) == TEMPLATE_TYPE_PARM)
      return true;
    /* -- a qualified-id with a nested-name-specifier which contains a
          class-name that names a dependent type or whose unqualified-id
--- 11541,11548 ----
       A type is dependent if it is:

       -- a template parameter.  */
!   if (TREE_CODE (type) == TEMPLATE_TYPE_PARM
!       || TREE_CODE (type) == TEMPLATE_TEMPLATE_PARM)
      return true;
    /* -- a qualified-id with a nested-name-specifier which contains a
          class-name that names a dependent type or whose unqualified-id




// { dg-do compile }
// Contributed by: Niall Douglas <s_gccbugzilla at netprod dot com>
// PR c++/14284: Failure to select specialization

template<typename> struct S;
template<template<class> class> struct I {};

template<class, int> struct Match;

template<template<class> class C>
struct Match<I<C>, 0> {};

template<template<class> class C, int i>
struct Match<I<C>, i>;

Match<I<S>, 0> v;



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