This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/64759] The compiler does NOT show a warning in a case where it is reasonable to expect a warning message.
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 24 Jan 2015 14:53:52 +0000
- Subject: [Bug c++/64759] The compiler does NOT show a warning in a case where it is reasonable to expect a warning message.
- Auto-submitted: auto-generated
- References: <bug-64759-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64759
--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Lakshay Garg from comment #2)
> It makes sense to compare against 0 but not 0.0
Huh? Why not?
This code seems perfectly reasonable to me:
double divisor;
std::cin >> divisor;
if (!divisor)
throw std::invalid_argument("Divide by zero attempted");