Bug 28992 - g++ lacks the "empty bodyin an if-statement" warning emitted by gcc
Summary: g++ lacks the "empty bodyin an if-statement" warning emitted by gcc
Status: RESOLVED DUPLICATE of bug 5520
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.1.0
: P3 enhancement
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-09-08 22:45 UTC by simon_baldwin
Modified: 2006-09-08 23:28 UTC (History)
7 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description simon_baldwin 2006-09-08 22:45:14 UTC
$ cat bad_if.cc
#include <stdio.h>

int main() {
  if (0); {  /* Semicolon accidentally added between condition and brace. */
    printf("Not intended to be printed\n");
  }

  return 0;
}

$ .../i686-unknown-linux-gnu-g++ --version
i686-unknown-linux-gnu-g++ (GCC) 4.1.0

$ .../i686-unknown-linux-gnu-g++ -W -Werror -o bad_if bad_if.cc; echo $?
0

$ .../i686-unknown-linux-gnu-g++ -xc -W -Werror -o bad_if bad_if.cc; echo $?
cc1: warnings being treated as errors
bad_if.cc: In function 'main':
bad_if.cc:4: warning: empty body in an if-statement
1
Comment 1 Andrew Pinski 2006-09-08 23:28:47 UTC
This is a dup of bug 5520 which was fixed in 4.2.0.

*** This bug has been marked as a duplicate of 5520 ***