tree.c (cp_build_qualified_type_real): Use CP_TYPE_QUALS to check whether we already...
authorNathan Sidwell <nathan@codesourcery.com>
Wed, 14 Feb 2001 09:45:29 +0000 (09:45 +0000)
committerNathan Sidwell <nathan@gcc.gnu.org>
Wed, 14 Feb 2001 09:45:29 +0000 (09:45 +0000)
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.

From-SVN: r39665

gcc/cp/ChangeLog
gcc/cp/tree.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.old-deja/g++.pt/deduct5.C [new file with mode: 0644]

index 4dad89821ba87ec7adec30dcc2fd539c00ab6fa6..746b2f52703a2bf7c6b43ed718dc6527bbdd0e8c 100644 (file)
@@ -1,3 +1,8 @@
+2001-02-14  Nathan Sidwell  <nathan@codesourcery.com>
+
+       * tree.c (cp_build_qualified_type_real): Use CP_TYPE_QUALS to
+       check whether we already have the type.
+
 2001-02-13  Mark Mitchell  <mark@codesourcery.com>
 
        * cp-tree.h (CLASSTYPE_DESTRUCTORS): Fix typo in comment.
index f7199f0b0daf8843fc649c0a43d5585a9e632bb2..bd65fee987ca5fa6cdb75f46968e53df272484f2 100644 (file)
@@ -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)
index 8a5f0f03e83b68b03e5c34be990a639639c3d4af..60fd86894d0494f696bee0eb1c7e6cc14ca1302a 100644 (file)
@@ -1,3 +1,7 @@
+2001-02-14  Nathan Sidwell  <nathan@codesourcery.com>
+
+       * g++.old-deja/g++.pt/deduct5.C: New test.
+
 2001-02-14  Jakub Jelinek  <jakub@redhat.com>
 
        * 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 (file)
index 0000000..d47a766
--- /dev/null
@@ -0,0 +1,33 @@
+// Copyright (C) 2000 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 13 Feb 2001 <nathan@codesourcery.com>
+
+// Bug 1960. We were not dealing with qualified array types properly.
+
+#include <stdio.h>
+
+template <typename T> 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;
+}