+2006-06-06 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/27177
+ * call.c (standard_conversion): Require that the derived type be
+ complete when performing a derived-to-base conversion.
+
2006-06-04 Mark Mitchell <mark@codesourcery.com>
PR c++/27819
that necessitates this conversion is ill-formed.
Therefore, we use DERIVED_FROM_P, and do not check
access or uniqueness. */
- && DERIVED_FROM_P (TREE_TYPE (to), TREE_TYPE (from)))
+ && DERIVED_FROM_P (TREE_TYPE (to), TREE_TYPE (from))
+ /* If FROM is not yet complete, then we must be parsing
+ the body of a class. We know what's derived from
+ what, but we can't actually perform a
+ derived-to-base conversion. For example, in:
+
+ struct D : public B {
+ static const int i = sizeof((B*)(D*)0);
+ };
+
+ the D*-to-B* conversion is a reinterpret_cast, not a
+ static_cast. */
+ && COMPLETE_TYPE_P (TREE_TYPE (from)))
{
from =
cp_build_qualified_type (TREE_TYPE (to),
+2006-06-06 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/27177
+ * g++.dg/expr/cast7.C: New test.
+
2006-06-06 Janis Johnson <janis187@us.ibm.com>
* lib/gcc-dg.exp (gcc-dg-test-1): Detect and report ICE.
--- /dev/null
+// PR c++/27177
+
+struct X {};
+
+struct Y : virtual X {};
+struct Z : virtual X {};
+
+struct A : Y, Z {};
+
+struct B : A
+{
+ static const int i = sizeof((Z*)(B*)0);
+};