This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/65043] New: Expected narrowing conversion during list initialization of bool from double
- From: "yaghmour.shafik at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 12 Feb 2015 16:34:29 +0000
- Subject: [Bug c++/65043] New: Expected narrowing conversion during list initialization of bool from double
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65043
Bug ID: 65043
Summary: Expected narrowing conversion during list
initialization of bool from double
Product: gcc
Version: 5.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: yaghmour.shafik at gmail dot com
Given the following code form this stackoverflow question
http://stackoverflow.com/q/27507361/1708801 :
#include <iostream>
struct X
{
X(bool arg) { std::cout << arg << '\n'; }
};
int main()
{
double d = 7.0;
X x{d};
}
I expect a narrowing conversion error on this line:
X x{d};
Neither clang nor gcc produce an error although Visual Studio does. Although
the comment is now deleted Jonathan Wakely noted that the EDG compiler gives a
narrowing error for the code.