pt.c (unify): Don't check cv quals of array types.

cp:
	* pt.c (unify): Don't check cv quals of array types.
testsuite:
	* g++.old-deja/g++.pt/deduct6.C: New test.

From-SVN: r39666
This commit is contained in:
Nathan Sidwell 2001-02-14 09:50:06 +00:00 committed by Nathan Sidwell
parent 7773899b5f
commit d0ab76243b
4 changed files with 36 additions and 0 deletions

View File

@ -1,3 +1,7 @@
2001-02-14 Nathan Sidwell <nathan@codesourcery.com>
* pt.c (unify): Don't check cv quals of array types.
2001-02-14 Nathan Sidwell <nathan@codesourcery.com>
* tree.c (cp_build_qualified_type_real): Use CP_TYPE_QUALS to

View File

@ -8552,6 +8552,10 @@ unify (tparms, targs, parm, arg, strict)
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

View File

@ -1,3 +1,7 @@
2001-02-14 Nathan Sidwell <nathan@codesourcery.com>
* g++.old-deja/g++.pt/deduct6.C: New test.
2001-02-14 Nathan Sidwell <nathan@codesourcery.com>
* g++.old-deja/g++.pt/deduct5.C: New test.

View File

@ -0,0 +1,24 @@
// 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;
}