This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/13683] New: [3.3/3.4 Regression] bogus warning about passing non-PODs through ellipsis


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]