[Bug c++/65043] Expected narrowing conversion during list initialization of bool from double
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65043 Jonathan Wakely changed: What|Removed |Added CC||vz-gcc at zeitlins dot org --- Comment #6 from Jonathan Wakely --- *** Bug 87120 has been marked as a duplicate of this bug. ***
[Bug c++/65043] Expected narrowing conversion during list initialization of bool from double
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65043 Marek Polacek changed: What|Removed |Added Status|ASSIGNED|RESOLVED Resolution|--- |FIXED --- Comment #5 from Marek Polacek --- Fixed.
[Bug c++/65043] Expected narrowing conversion during list initialization of bool from double
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65043 --- Comment #4 from Marek Polacek --- Author: mpolacek Date: Tue Aug 21 15:25:17 2018 New Revision: 263739 URL: https://gcc.gnu.org/viewcvs?rev=263739=gcc=rev Log: PR c++/65043 * call.c (standard_conversion): Set check_narrowing. * typeck2.c (check_narrowing): Use CP_INTEGRAL_TYPE_P rather than comparing with INTEGER_TYPE. * g++.dg/concepts/pr67595.C: Add dg-warning. * g++.dg/cpp0x/Wnarrowing11.C: New test. * g++.dg/cpp0x/Wnarrowing12.C: New test. * g++.dg/cpp0x/rv-cast5.C: Add static_cast. Added: trunk/gcc/testsuite/g++.dg/cpp0x/Wnarrowing11.C trunk/gcc/testsuite/g++.dg/cpp0x/Wnarrowing12.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/call.c trunk/gcc/cp/typeck2.c trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/g++.dg/concepts/pr67595.C trunk/gcc/testsuite/g++.dg/cpp0x/rv-cast5.C
[Bug c++/65043] Expected narrowing conversion during list initialization of bool from double
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65043 --- Comment #3 from Marek Polacek --- Testing a patch now.
[Bug c++/65043] Expected narrowing conversion during list initialization of bool from double
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65043 --- Comment #2 from Marek Polacek --- Simplified: struct X { X(bool) { } }; int main() { X x{1.2}; }
[Bug c++/65043] Expected narrowing conversion during list initialization of bool from double
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65043 Marek Polacek changed: What|Removed |Added Status|NEW |ASSIGNED CC||mpolacek at gcc dot gnu.org Assignee|unassigned at gcc dot gnu.org |mpolacek at gcc dot gnu.org
[Bug c++/65043] Expected narrowing conversion during list initialization of bool from double
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65043 Jonathan Wakely changed: What|Removed |Added Keywords||accepts-invalid Status|UNCONFIRMED |NEW Last reconfirmed||2017-06-01 Ever confirmed|0 |1 --- Comment #1 from Jonathan Wakely --- Clang does now: narrow.cc:9:9: error: type 'double' cannot be narrowed to 'bool' in initializer list [-Wc++11-narrowing] X x{d}; ^ narrow.cc:9:9: note: insert an explicit cast to silence this issue X x{d}; ^ static_cast( ) 1 error generated. And EDG gives: "narrow.cc", line 9: error: invalid narrowing conversion from "double" to "bool" X x{d}; ^ 1 error detected in the compilation of "narrow.cc".