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

Douglas Gregor dgregor at apple.com
Thu May 19 21:36:02 PDT 2011


On May 19, 2011, at 3:15 PM, Tomasz Dabrowski wrote:

> 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.

Please file a bug at http://llvm.org/bugs/ 

> 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.


It makes sense to model the semantics properly for C++0x; I don't see any specific reason to disable this check.

	- Doug



More information about the cfe-dev mailing list