[PATCH] D52835: [Diagnostics] Check integer to floating point number implicit conversions
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 29 04:59:22 PST 2018
aaron.ballman added inline comments.
================
Comment at: test/CXX/dcl.decl/dcl.init/dcl.init.list/p7-0x.cpp:136
Agg<float> f8 = {EnumVal}; // OK
+ // expected-warning at +1 {{implicit conversion from 'int' to 'float' changes value from 123456789 to 1.2345679E+8}}
Agg<float> f9 = {123456789}; // expected-error {{ cannot be narrowed }} expected-note {{silence}}
----------------
I don't think we want the warning triggered in either of these cases -- they already have an error diagnostic on the same line for the same issue.
================
Comment at: test/CXX/dcl.decl/dcl.init/dcl.init.list/p7-cxx11-nowarn.cpp:124
Agg<float> f4 = {12345678}; // OK (exactly fits in a float)
+ // expected-warning at +1 {{implicit conversion from 'int' to 'float' changes value from 123456789 to 1.2345679E+8}}
Agg<float> f5 = {123456789}; // expected-warning {{ cannot be narrowed }} expected-note {{silence}}
----------------
I think we don't want to duplicate the warnings here, either.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D52835/new/
https://reviews.llvm.org/D52835
More information about the cfe-commits
mailing list