
On 08/26/2010 08:44 PM, Bryce Lelbach aka wash wrote:
In the meantime, I found that variadic templates work just fine in gcc-4.4, even without the -std=c++0x option, but they emit warnings. According to the gcc mailing list, these cannot be suppressed (except by turning on said option).
I took a look at the gcc source - there's definitely no flag to disable that warning, but #pragma GCC system_header will do the trick (recent versions of libstdc++ use variadic templates with or without c++0x support enabled). It won't work in C++ source files, just in headers; adding #pragma GCC system_header will tell GCC to treat everything from the pragma to the end of the file as a system header. Note that this will disable a boatload of other warnings.
Bryce, yeah, the system_header pragma or the -isystem option are pretty cool if you know for sure that all warnings can be safely ignored. But when developing something new, this is rarely the case. So what I am doing now (seems to work fine): Most of the time, I compile without -std=c++0x, because most of the time, I don't use those new features. But there are some rather isolated classes that use variadic templates for a type-safe communication layer for postgresql. Those classes are compiled with -std=c++0x. Thanks and regards, Roland