PR c++/4203
* call.c (build_over_call): Do not optimize any empty base
construction.
testsuite:
PR c++/4203
* g++.old-deja/g++.other/empty1.C: XFAIL. See PR c++/4222
* g++.dg/init/empty1.C: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@45374
138bc75d-0d04-0410-961f-
82ee72b054a4
+2001-09-04 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/4203
+ * call.c (build_over_call): Do not optimize any empty base
+ construction.
+
2001-08-31 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
* error.c (dump_template_decl): Output template parameters
else if (TYPE_HAS_TRIVIAL_INIT_REF (DECL_CONTEXT (fn)))
return build_target_expr_with_type (arg, DECL_CONTEXT (fn));
}
- else if (! real_lvalue_p (arg)
+ else if ((!real_lvalue_p (arg)
+ || TYPE_HAS_TRIVIAL_INIT_REF (DECL_CONTEXT (fn)))
/* Empty classes have padding which can be hidden
inside an (empty) base of the class. This must not
be touched as it might overlay things. When the
gcc core learns about empty classes, we can treat it
like other classes. */
- || (!is_empty_class (DECL_CONTEXT (fn))
- && TYPE_HAS_TRIVIAL_INIT_REF (DECL_CONTEXT (fn))))
+ && !is_empty_class (DECL_CONTEXT (fn)))
{
tree address;
tree to = stabilize_reference
+2001-09-04 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/4203
+ * g++.old-deja/g++.other/empty1.C: XFAIL. See PR c++/4222
+ * g++.dg/init/empty1.C: New test.
+
2001-09-03 Jakub Jelinek <jakub@redhat.com>
* gcc.c-torture/compile/20010903-1.c: New test.
--- /dev/null
+// { dg-do run }
+
+// Copyright (C) 2001 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 3 Sept 2001 <nathan@codesourcery.com>
+
+// Bug 4203. We were bit copying empty bases including the
+// padding. Which clobbers whatever they overlay.
+
+class EmptyBase0 {};
+class EmptyBase1 : public EmptyBase0 {};
+class Base1
+{
+public:
+unsigned int t_;
+Base1(unsigned int t) : t_(t) {}
+};
+
+class PEPE : public Base1, public EmptyBase1
+{
+public:
+PEPE(unsigned int t)
+ : Base1(t), EmptyBase1(EmptyBase1()) {}
+};
+
+int main()
+{
+ PEPE pepe(0xff);
+
+ return pepe.t_ != 255;
+}
// Origin: Mark Mitchell <mark@codesourcery.com>
+// This test case checks that the return value optimization works for
+// empty classes.
+
+// xfailed because empty classes clobbering what they overlay as the
+// backend treats them as single byte objects. See bug 4222
+// execution test - XFAIL *-*-*
extern "C" void abort();
extern "C" int printf (const char *, ...);