I've done some heavy refactoring of some C++ code, and discovered numerous bugs arising from implicit conversions that I'm not aware of.
Example
struct A *a();
bool b() {
return a();
}
void c() {
int64_t const d(b());
}
Issues
- In
b
, the return type ofa
is silently cast tobool
. - In
c
, the value returned fromb
is silently promoted toint64_t
.
Question
How can I receive warnings or errors for the implicit conversion between primitive types?
Note
- The use of
-Wconversion
seems to only pick up several arbitrary conversions unrelated to the example above. BOOST_STRONG_TYPEDEF
is not an option (my types need to be PODs, as they're used in disk structures).- C is also of interest, however this problem pertains to a C++ code base.