Subject: [Boost-bugs] [Boost C++ Libraries] #9239: Implicit type conversion without warning, although Wconversion used
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-10-11 15:49:45
#9239: Implicit type conversion without warning, although Wconversion used
-----------------------------------------+-----------------------------
Reporter: Daniel Rings <topwohnung@â¦> | Owner: matthiasschabel
Type: Bugs | Status: new
Milestone: To Be Determined | Component: units
Version: Boost 1.54.0 | Severity: Problem
Keywords: units auto |
-----------------------------------------+-----------------------------
When defining a variable with automatic type recognition,
{{{
auto inv_time = 1/si::second;
}}}
this instruction
{{{
inv_time = 0.4/si::second;
}}}
does not generate a warning (using -Wconversion), while
{{{
auto p = 3;
p = 1.0/2.0;
}}}
generates a warning, as it should. Is there any reason for the different
behavior in both cases?
It should be mentioned that this is not contingent to "auto", for
{{{
quantity<si::time,int> time = 1/(1/si::second);
time = 0.4*si::second;
}}}
compiles without warning, too (and time = 0 s in the end). I thought
implicit typecasts with possible loss of precision were forbidden or would
at least trigger a warning.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/9239> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:14 UTC