This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/38908] [4.4 regression] Unexplained "'<anonymous>' is used uninitialized in this function" warning in cc1plus -m64
- From: "mmitchel at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 28 Jan 2009 23:56:16 -0000
- Subject: [Bug c++/38908] [4.4 regression] Unexplained "'<anonymous>' is used uninitialized in this function" warning in cc1plus -m64
- References: <bug-38908-11271@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #13 from mmitchel at gcc dot gnu dot org 2009-01-28 23:56 -------
Actually, CLASSTYPE_EMPTY_P is probably a fine thing to use for C++. (It's of
course C++ specific; you'd either need to access it via a hook, or promote to a
language-independent bit.) CLASSTYPE_EMPTY_P will not capture an array of
empty objects, but that's an extreme corner-case.
Note that CLASSTYPE_EMPTY_P classes may have arbitrary size. That's because of
things like:
struct A{};
struct B : public A {};
struct C : public A, public B {};
In C, you cannot put the B sub-object at the same address as the A sub-object
since that would end up with two A sub-objects (the A-in-B-in-C subobject and
A-in-C subobject) at the same address. So, C will be a two-byte structure.
Obviously, you can generalize this to make arbitrarily huge empty classes.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38908