]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/8031 (ICE in comptypes, at cp/typeck.c:913)
authorGabriel Dos Reis <gdr@integrable-solutions.net>
Fri, 13 Dec 2002 21:54:46 +0000 (21:54 +0000)
committerGabriel Dos Reis <gdr@gcc.gnu.org>
Fri, 13 Dec 2002 21:54:46 +0000 (21:54 +0000)
PR C++/8031
* cvt.c (convert_to_pointer_force): Don't try comparing against
erronous type.

From-SVN: r60105

gcc/cp/ChangeLog
gcc/cp/cvt.c
gcc/testsuite/g++.dg/conversion/to-virtual-base-1.C [new file with mode: 0644]

index 213fc233e072f974206ae41a62031cacc9ad8b16..30704d90ecfeae95dd86fd293e483f05bad7a9f2 100644 (file)
@@ -1,3 +1,9 @@
+2002-12-13  Gabriel Dos Reis  <gdr@integrable-solutions.net>
+       
+        PR C++/8031
+       * cvt.c (convert_to_pointer_force): Don't try comparing against
+       erronous type.
+
 2002-12-10  Mark Mitchell  <mark@codesourcery.com>
 
        PR c++/8372
index 5e6c92c2bacf5093d5dad19b4c3a32df698bf6f9..1603a2a00adb4b08a8700b69b40a589a9d9dc4a1 100644 (file)
@@ -313,6 +313,8 @@ convert_to_pointer_force (type, expr)
          if (binfo)
            {
              expr = build_base_path (code, expr, binfo, 0);
+             if (expr == error_mark_node)
+               return error_mark_node;
              /* Add any qualifier conversions. */
              if (!same_type_p (TREE_TYPE (TREE_TYPE (expr)),
                                TREE_TYPE (type)))
diff --git a/gcc/testsuite/g++.dg/conversion/to-virtual-base-1.C b/gcc/testsuite/g++.dg/conversion/to-virtual-base-1.C
new file mode 100644 (file)
index 0000000..3fa8e41
--- /dev/null
@@ -0,0 +1,15 @@
+// Copyright (C) 2002 Free Software Foundation
+// Contributed by Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+struct A {
+  virtual void f(const A* a) = 0;
+};
+
+struct B : virtual A {
+  virtual void f(const A* a);
+};
+
+void B::f(const A* a)
+{
+  static_cast<const B&>(*a);             // { dg-error "" }
+}