[cfe-dev] Option to disable POD check for variadic functions

Tomasz Dabrowski dabroz at gmail.com
Thu May 19 15:15:54 PDT 2011


Hello,

is it possible to disable POD check for variadic functions? For example:

error: cannot pass object of non-POD type 'string' through variadic
function; call will abort at runtime [-Wnon-pod-varargs]
for:
struct string { const char * str; string() {}; };
string s;
printf("%s", s);

POD definition was updated (relaxed) in C++0x:
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2294.html
but it seems that Clang doesn't support this yet even in C++0x mode.

Microsoft's compiler ignores POD check, GCC in "regular" C++ behaves
similar to Clang up to version 4.5. GCC in C++0x mode or GCC >= 4.5
accepts such code.
"Diagnostics that used to complain about passing non-POD types to ...
or jumping past the declaration of a non-POD variable now check for
triviality rather than PODness, as per C++0x."
Possibility to ignore POD check would be very helpful.

--
Tomasz DÄ…browski




More information about the cfe-dev mailing list