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 3518


Hi,
I've installed this patch to fix 3518, after checking with John Spicer
as to the rules in this area.

tested on i686-pc-linux-gnu.

nathan
--
Nathan Sidwell    ::   http://www.codesourcery.com   ::     CodeSourcery LLC
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk

2004-04-05  Nathan Sidwell  <nathan@codesourcery.com>

	PR c++/3518
	* pt.c (check_cv_quals_for_unify): Ignore bogus CV quals at outer
	level.

Index: cp/pt.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/pt.c,v
retrieving revision 1.846
diff -c -3 -p -r1.846 pt.c
*** cp/pt.c	2 Apr 2004 11:48:53 -0000	1.846
--- cp/pt.c	5 Apr 2004 13:54:16 -0000
*************** check_cv_quals_for_unify (int strict, tr
*** 9551,9563 ****
    int arg_quals = cp_type_quals (arg);
    int parm_quals = cp_type_quals (parm);
  
!   if (TREE_CODE (parm) == TEMPLATE_TYPE_PARM)
      {
        /*  Although a CVR qualifier is ignored when being applied to a
            substituted template parameter ([8.3.2]/1 for example), that
            does not apply during deduction [14.8.2.4]/1, (even though
            that is not explicitly mentioned, [14.8.2.4]/9 indicates
!           this). */
        if ((TREE_CODE (arg) == REFERENCE_TYPE
  	   || TREE_CODE (arg) == FUNCTION_TYPE
  	   || TREE_CODE (arg) == METHOD_TYPE)
--- 9551,9565 ----
    int arg_quals = cp_type_quals (arg);
    int parm_quals = cp_type_quals (parm);
  
!   if (TREE_CODE (parm) == TEMPLATE_TYPE_PARM
!       && !(strict & UNIFY_ALLOW_OUTER_MORE_CV_QUAL))
      {
        /*  Although a CVR qualifier is ignored when being applied to a
            substituted template parameter ([8.3.2]/1 for example), that
            does not apply during deduction [14.8.2.4]/1, (even though
            that is not explicitly mentioned, [14.8.2.4]/9 indicates
!           this).  Except when we're allowing additional CV qualifiers
!           at the outer level [14.8.2.1]/3,1st bullet.  */
        if ((TREE_CODE (arg) == REFERENCE_TYPE
  	   || TREE_CODE (arg) == FUNCTION_TYPE
  	   || TREE_CODE (arg) == METHOD_TYPE)
// Copyright (C) 2004 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 1 Apr 2004 <nathan@codesourcery.com>

// PR c++/3518
template <typename T> void Foo (const T &);
template <typename T> void Baz (const T (*)());

int &f ();

int main()
{
  Foo (f);
  Baz (f); // { dg-error "no matching function" "" }
}

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