https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119222

            Bug ID: 119222
           Summary: Conversion of inf to integer is not diagnosed
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: antoshkka at gmail dot com
  Target Milestone: ---

Consider the following example:

int foo() {
    return 1 / static_cast<double>(0);
}


With -Wall -Wextra there is no warning about an undefined behavior
([conv.fpint] p1 "The behavior is undefined if the truncated value cannot be
represented in the destination type.")

Please add a warning

Godbolt playground: https://godbolt.org/z/cMYo6xPaY

Reply via email to