mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-26 11:56:07 +00:00

Issue an warning when the code tries to do an implicit int -> float conversion, where the float type ha a narrower significant than the float type. The new warning is controlled by flag -Wimplicit-int-float-conversion, under -Wimplicit-float-conversion and -Wconversion. It is also silenced when c++11 narrowing warning is issued. Differential Revision: https://reviews.llvm.org/D64666 llvm-svn: 367497
11 lines
340 B
C++
11 lines
340 B
C++
// RUN: %clang_cc1 %s -verify -Wno-conversion -Wno-c++11-narrowing -Wimplicit-int-float-conversion
|
|
|
|
void testNoWarningOnNarrowing() {
|
|
// Test that we do not issue duplicated warnings for
|
|
// C++11 narrowing.
|
|
float a = {222222222222L}; // expected-no-diagnostics
|
|
|
|
long b = 222222222222L;
|
|
float c = {b}; // expected-no-diagnostics
|
|
}
|