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: Thu, 29 Jan 2015 20:45:43 +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 #4 from Tom Tromey <tromey at gcc dot gnu.org> ---
Thanks, I'll give it a try.
Here's my test case FWIW and a short demo showing what clang does:
pokyo. cat q.cc
#include <stdarg.h>
class ConstUTF8CharsZ
{
const char *mData;
public:
ConstUTF8CharsZ() : mData(0)
{
}
explicit ConstUTF8CharsZ(const char *aBytes)
: mData(aBytes)
{
}
const void *get() const { return mData; }
const char *c_str() const { return mData; }
operator bool() const { return mData != 0; }
};
void zzz(const char *x, ...) {
}
void m(const char *m) {
ConstUTF8CharsZ cu(m);
zzz(m, cu);
}
pokyo. clang++ q.cc
q.cc:30:10: error: cannot pass object of non-POD type 'ConstUTF8CharsZ' through
variadic function; call will abort at runtime [-Wnon-pod-varargs]
zzz(m, cu);
^
1 error generated.