2013-02-13 Jason Merrill <jason@redhat.com>
+ PR c++/55993
+ * semantics.c (cxx_fold_indirect_ref): Handle empty bases at
+ non-zero offsets, too.
+
PR c++/56155
* decl.c (build_enumerator): Always convert the value to a
fixed underlying type.
return build4_loc (loc, ARRAY_REF, type, op00, op01,
NULL_TREE, NULL_TREE);
}
+ /* Also handle conversion to an empty base class, which
+ is represented with a NOP_EXPR. */
+ else if (is_empty_class (type)
+ && CLASS_TYPE_P (op00type)
+ && DERIVED_FROM_P (type, op00type))
+ {
+ *empty_base = true;
+ return op00;
+ }
/* ((foo *)&struct_with_foo_field)[1] => COMPONENT_REF */
else if (RECORD_OR_UNION_TYPE_P (op00type))
{
--- /dev/null
+// PR c++/55993
+// { dg-do compile { target c++11 } }
+
+struct A {};
+struct B:A {};
+struct C:A {};
+struct D:B,C {};
+
+constexpr D d {};
+constexpr const C& e=d; // OK
+constexpr auto f=static_cast<const C&>(d); // FAIL