http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47347
Summary: "pragma GCC diagnostic ignored" has no effect sometimes Product: gcc Version: 4.5.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: g...@dpinol.com The code below produces warning "warning: unused parameter ‘a’ [-Wunused-parameter]" were it shouldn't, since this diagnostic should be ignored. If we remove the final line, the warning does not appear, but I understand that a pragma should not affect previous lines. #pragma GCC diagnostic ignored "-Wunused-parameter" #include <vector> template <class ContainerAllocator> struct KeyValue { public: virtual ~KeyValue() { } virtual void serialize(int a) const { } }; void f() { std::vector< KeyValue<int > > values; } #pragma GCC diagnostic warning "-Wunused-parameter"