This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/13683] New: [3.3/3.4 Regression] bogus warning about passing non-PODs through ellipsis
- From: "giovannibajo at libero dot it" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 14 Jan 2004 16:57:07 -0000
- Subject: [Bug c++/13683] New: [3.3/3.4 Regression] bogus warning about passing non-PODs through ellipsis
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
The following code emits a bogus warning:
-----------------------------------------------------
struct B {};
struct NonPOD : B {};
struct A
{
static int check(...);
static NonPOD GetNonPOD(void);
enum { value = sizeof(A::check(A::GetNonPOD())) };
};
-----------------------------------------------------
bogus.cc:8: warning: cannot pass objects of non-POD type `struct NonPOD'
through `...'; call will abort at runtime
The problem is that GCC fails to realize that the function call will never
happen because it's done in the context of a sizeof() expression. Thus, the
warning should not be emitted. Notice that this warning is on by default, and I
don't even know if there is a way to shut it off.
Regression since 2.95 (where the warning probably didn't exist, but from an
user standpoint it's a regression).
BTW this was noticed with Boost code, so it's real world stuff. Luckily, the
warning is not affected by -Werror. I rate this as a very minor regression, but
it would be great if we could fix it someday.
--
Summary: [3.3/3.4 Regression] bogus warning about passing non-
PODs through ellipsis
Product: gcc
Version: 3.4.0
Status: UNCONFIRMED
Keywords: diagnostic
Severity: minor
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: giovannibajo at libero dot it
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13683