This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/64867] warning for passing non-POD to varargs function
- From: "tromey at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 30 Jan 2015 17:40:23 +0000
- Subject: [Bug c++/64867] warning for passing non-POD to varargs function
- Auto-submitted: auto-generated
- References: <bug-64867-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64867
--- Comment #9 from Tom Tromey <tromey at gcc dot gnu.org> ---
> Are you sure that class is not trivial which is why gcc is not warning about
> it? C++11 does not really have pod and non-pod any more but rather trivial
> and non-trivial and the rules has chnaged with respect of constructures.
I hesitate to say I'm sure :)
However my belief is that because this class has a user-provided
default constructor, it is not trivial.
I tested this by adding "#include <type_traits>" and then
static_assert(!std::is_trivial<ConstUTF8CharsZ>::value, "whoops");
Trivial or not, I'd like to get a warning here. In firefox varargs
is really only used for printf-like things; but for various reasons
there are some custom implementations which can't be marked
with the "printf" attribute. So while doing a refactoring it turned
out I inadvertently changed code to pass objects rather than char*
to one of these ... but finding the problem locations is proving
to be rather difficult.