https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95767
Bug ID: 95767 Summary: No warning when branching on two identical conditions Product: gcc Version: 9.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: mrbart at gmx dot com Target Milestone: --- Created attachment 48757 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48757&action=edit Minimal-working example #include <iostream> #include <string> int main() { std::string input; std::cin >> input; std::string output; if (input == "option1") output = "option1 chosen"; else if (input == "option2") output = "option2 chosen"; else if (input == "option2") output = "option3 chosen"; return 0; } Shouldn't the compiler issue a warning that we check twice for the same condition? Copy-and-past quickly can lead to a mistake here. Compiled with: g++ -Wall -Wextra Test.cpp Tested on: gcc (Ubuntu 9.2.1-9ubuntu2) 9.2.1 20191008 Ubuntu Linux 19.10 64 bit Intel® Core™ i5-2500 CPU