search.c (setup_class_bindings): Robustify.
authorMark Mitchell <mark@codesourcery.com>
Wed, 18 Aug 1999 22:11:10 +0000 (22:11 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Wed, 18 Aug 1999 22:11:10 +0000 (22:11 +0000)
* search.c (setup_class_bindings): Robustify.
* typeck.c (common_type): Use same_type_p, not pointer equality,
to compare types.

From-SVN: r28756

gcc/cp/ChangeLog
gcc/cp/search.c
gcc/cp/typeck.c
gcc/testsuite/g++.old-deja/g++.pt/crash46.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.pt/crash47.C [new file with mode: 0644]

index 0e1012f817176dac36f04e8452155ea04bf3b20b..6e44c4fcf62d731d42ba10538bc6ef1bda8714f4 100644 (file)
@@ -1,5 +1,9 @@
 1999-08-18  Mark Mitchell  <mark@codesourcery.com>
 
+       * search.c (setup_class_bindings): Robustify.
+       * typeck.c (common_type): Use same_type_p, not pointer equality,
+       to compare types.
+
         * cp-tree.h (build_lang_field_decl): Remove.
        * class.c (build_vtable): Replace calls to build_lang_field_decl
        with build_lang_decl.
index 300d7107cf4a9c6d92c48439c207d2cdf5d6673b..62fa4024b9ba58447f282b346c35e6b984bf679c 100644 (file)
@@ -2960,7 +2960,7 @@ setup_class_bindings (name, type_binding_p)
        binding.  This means that we already processed this binding
        above.  */
     my_friendly_assert (type_binding_p, 19990401);
-  else
+  else if (value_binding)
     {
       if (TREE_CODE (value_binding) == TREE_LIST 
          && TREE_TYPE (value_binding) == error_mark_node)
index 5d12bee3ada6601a7ae5fc1ad245489f57cc2162..716fe19323d0e2e3317f66b9a751bb019d0af13e 100644 (file)
@@ -698,7 +698,7 @@ common_type (t1, t2)
        tt1 = TYPE_MAIN_VARIANT (tt1);
        tt2 = TYPE_MAIN_VARIANT (tt2);
 
-       if (tt1 == tt2)
+       if (same_type_p (tt1, tt2))
          target = tt1;
        else if (b1)
          {
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/crash46.C b/gcc/testsuite/g++.old-deja/g++.pt/crash46.C
new file mode 100644 (file)
index 0000000..e226559
--- /dev/null
@@ -0,0 +1,8 @@
+// Build don't link:
+// Origin: Leon Bottou <leonb@research.att.com>
+
+class AA { protected:
+  template <class T> struct BB { T x; BB(const T &x) : x(x) { }; };
+  template <class T> struct CC : public BB<T> { CC(const T &x) : BB<T>(x) { };
+};
+};
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/crash47.C b/gcc/testsuite/g++.old-deja/g++.pt/crash47.C
new file mode 100644 (file)
index 0000000..96a23fd
--- /dev/null
@@ -0,0 +1,17 @@
+// Build don't link:
+// Origin: Rick Campbell <rick.campbell@db.com>
+
+template <class Owner, typename Type>
+struct DataMember
+{
+    inline DataMember (Type Owner::* data_member);
+
+    Type Owner::* _data_member;
+};
+
+template <class Owner, typename Type>
+inline
+DataMember<Owner,Type>::DataMember (Type Owner::* data_member)
+    : _data_member (data_member)
+{
+}