From 8ee959f549a9c3020515d014f740c1512e16f2a9 Mon Sep 17 00:00:00 2001 From: nathan Date: Wed, 14 Feb 2001 09:45:29 +0000 Subject: [PATCH] cp: * tree.c (cp_build_qualified_type_real): Use CP_TYPE_QUALS to check whether we already have the type. testsuite: * g++.old-deja/g++.pt/deduct5.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@39665 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/tree.c | 2 +- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/g++.old-deja/g++.pt/deduct5.C | 33 +++++++++++++++++++++++++++++ 4 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.old-deja/g++.pt/deduct5.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 4dad898..746b2f5 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2001-02-14 Nathan Sidwell + + * tree.c (cp_build_qualified_type_real): Use CP_TYPE_QUALS to + check whether we already have the type. + 2001-02-13 Mark Mitchell * cp-tree.h (CLASSTYPE_DESTRUCTORS): Fix typo in comment. diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index f7199f0..bd65fee 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -516,7 +516,7 @@ cp_build_qualified_type_real (type, type_quals, complain) if (type == error_mark_node) return type; - if (type_quals == TYPE_QUALS (type)) + if (type_quals == CP_TYPE_QUALS (type)) return type; /* A restrict-qualified pointer type must be a pointer (or reference) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8a5f0f0..60fd868 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2001-02-14 Nathan Sidwell + + * g++.old-deja/g++.pt/deduct5.C: New test. + 2001-02-14 Jakub Jelinek * gcc.c-torture/execute/20010209-1.c: New test. diff --git a/gcc/testsuite/g++.old-deja/g++.pt/deduct5.C b/gcc/testsuite/g++.old-deja/g++.pt/deduct5.C new file mode 100644 index 0000000..d47a766 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/deduct5.C @@ -0,0 +1,33 @@ +// Copyright (C) 2000 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 13 Feb 2001 + +// Bug 1960. We were not dealing with qualified array types properly. + +#include + +template int Foo (T const *ptr) +{ + static int count = 0; + + printf ("%s\n", __PRETTY_FUNCTION__); + count++; + + return count; +} + +int main () +{ + static int const cs = 1; + static int const ca[1] = {1}; + static int s = 1; + static int a[1] = {1}; + + Foo (&cs); + Foo (&ca); + if (Foo (&s) != 2) + return 1; + if (Foo (&a) != 2) + return 2; + + return 0; +} -- 2.7.4