https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61600
Bug ID: 61600 Summary: #pragma GCC diagnostic pop leaves warnings enabled Product: gcc Version: 4.8.2 Status: UNCONFIRMED Keywords: diagnostic Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: redi at gcc dot gnu.org Blocks: 58876 #pragma GCC diagnostic push #pragma GCC diagnostic warning "-Wunused-parameter" void foo(int i) { } #pragma GCC diagnostic pop void bar(int i) { } int main() { bar(1); } I expect a warning for foo() but not bar(), however compiling with no options I get: sys.cc:3:6: warning: unused parameter āiā [-Wunused-parameter] void foo(int i) { } ^ sys.cc:7:6: warning: unused parameter āiā [-Wunused-parameter] void bar(int i) { } ^ It appears that once I turn a warning on I can't disable it. Have I misunderstood the feature?