[Bug c/52050] New: -Wdeclaration-after-statement does not warn on declaration in for loop initialiser

mans at mansr dot com gcc-bugzilla@gcc.gnu.org
Sun Jan 29 23:14:00 GMT 2012


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52050

             Bug #: 52050
           Summary: -Wdeclaration-after-statement does not warn on
                    declaration in for loop initialiser
    Classification: Unclassified
           Product: gcc
           Version: 4.6.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: mans@mansr.com


Consider this code:

void foo(void)
{
    for (int i = 0; i < 2; i++);
}

Compiling the above code with -std=c99 -Wdeclaration-after-statement
does not produce a warning as expected.



More information about the Gcc-bugs mailing list