[LLVMbugs] [Bug 17833] C++11 Narrowing conversion from int to double should give warning, not error

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Nov 6 11:20:12 PST 2013


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

Richard Smith <richard-llvm at metafoo.co.uk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |richard-llvm at metafoo.co.uk
         Resolution|---                         |WORKSFORME

--- Comment #1 from Richard Smith <richard-llvm at metafoo.co.uk> ---
Resolving WORKSFORME: this error can already be disabled by using
-Wno-c++11-narrowing.

(In reply to comment #0)
> In my opinion, this should be a warning, not an error, because it breaks
> correct legacy code.

Such code is not correct C++11 code. Some porting effort should be expected
when trying to build C++98 code as C++11 code -- the new standard is not
entirely backwards-compatible.

> The conversion from int to double is not in fact
> narrowing, because there is no 32-bit integer value that cannot be
> represented as a double.

That is not how 'narrowing' is defined in the C++11 standard.

-- 
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/20131106/5867d220/attachment.html>


More information about the llvm-bugs mailing list