[Bug c++/96452] New: Narrowing conversion is not rejected

antoshkka at gmail dot com gcc-bugzilla@gcc.gnu.org
Tue Aug 4 08:36:11 GMT 2020


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

            Bug ID: 96452
           Summary: Narrowing conversion is not rejected
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Keywords: accepts-invalid
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: antoshkka at gmail dot com
  Target Milestone: ---

Consider the example:

float test_main(double d) {
    float f2{d};
    return f2;
}


Narrowing of double to float in brace-init is not rejected, only a warning is
issued. 


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


More information about the Gcc-bugs mailing list