This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[C++ PATCH] Fix bug 1962
- To: gcc-patches at gcc dot gnu dot org
- Subject: [C++ PATCH] Fix bug 1962
- From: Nathan Sidwell <nathan at codesourcery dot com>
- Date: Wed, 14 Feb 2001 10:01:54 +0000
- Organization: Codesourcery LLC
Hi,
I've installed this patch for bug 1962 where we were checking the cv quals
of array template args too early, so `T []' could never deduce 'X const []'.
built & tested on i686-pc-linux-gnu, approved by Mark.
I'll shortly be committing this to the branch too.
nathan
--
Dr Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery LLC
'But that's a lie.' - 'Yes it is. What's your point?'
nathan@codesourcery.com : http://www.cs.bris.ac.uk/~nathan/ : nathan@acm.org
2001-02-14 Nathan Sidwell <nathan@codesourcery.com>
* pt.c (unify): Don't check cv quals of array types.
Index: cp/pt.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/pt.c,v
retrieving revision 1.517
diff -c -3 -p -r1.517 pt.c
*** pt.c 2001/02/12 14:38:24 1.517
--- pt.c 2001/02/14 09:46:41
*************** unify (tparms, targs, parm, arg, strict)
*** 8552,8557 ****
--- 8552,8561 ----
cv-qualification mismatches. */
if (TREE_CODE (arg) == TREE_CODE (parm)
&& TYPE_P (arg)
+ /* It is the elements of the array which hold the cv quals of an array
+ type, and the elements might be template type parms. We'll check
+ when we recurse. */
+ && TREE_CODE (arg) != ARRAY_TYPE
/* We check the cv-qualifiers when unifying with template type
parameters below. We want to allow ARG `const T' to unify with
PARM `T' for example, when computing which of two templates
// Build don't link:
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 13 Feb 2001 <nathan@codesourcery.com>
// Bug 1962. We were not dealing with qualified array types properly.
#include <stdio.h>
template <typename T, unsigned I> int Baz (T (&obj)[I])
{
printf ("%s\n", __PRETTY_FUNCTION__);
return 1;
}
int main ()
{
static int const ca[1] = {1};
static int a[1] = {1};
Baz (ca);
Baz (a);
return 0;
}