[LLVMbugs] [Bug 22566] New: Expected narrowing conversion during list initialization of bool from double

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Feb 12 08:33:12 PST 2015


http://llvm.org/bugs/show_bug.cgi?id=22566

            Bug ID: 22566
           Summary: Expected narrowing conversion during list
                    initialization of bool from double
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: yaghmour.shafik at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

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.

Submitted a gcc bug report as well:

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

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150212/0f78e75c/attachment.html>


More information about the llvm-bugs mailing list