The following code compiles without warning and has an exit value of 1, which
is correct according to the standard. However, an implicit conversion from
double to int happened without a corresponding warning. This seems incorrect to
me, and similar to bug 24525 (
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24525 ).
struct T {
double x;
explicit T(double x) : x(x) {
}
operator double() {
return x;
}
};
T f() {
return T(5.3);
}
int main() {
double t = false ? 0 : f();
return t == 5.0;
}
--
Summary: Failure to warn about implicit conversion from double to
int
Product: gcc
Version: 4.4.3
Status: UNCONFIRMED
Severity: minor
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: alvaro dot begue at gmail dot com
GCC build triplet: x86_64-suse-linux
GCC host triplet: x86_64-suse-linux
GCC target triplet: x86_64-suse-linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44585