[Bug c++/44585] New: Failure to warn about implicit conversion from double to int

2010-06-18 Thread alvaro dot begue at gmail dot com
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



[Bug c++/44585] Failure to warn about implicit conversion from double to int

2010-06-18 Thread alvaro dot begue at gmail dot com


--- Comment #1 from alvaro dot begue at gmail dot com  2010-06-18 20:42 
---
I just learned about -Wconversion and gcc does indeed warn about the implicit
conversion from double to int when I specify it. Sorry for the false alarm.


-- 

alvaro dot begue at gmail dot com changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution||INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44585