public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/45385]  New: -Wconversion fails to detect a real conversion loss
@ 2010-08-23 16:06 mendola at gmail dot com
  2010-08-25 11:12 ` [Bug c++/45385] missing -Wconversion for method calls pinskia at gcc dot gnu dot org
  0 siblings, 1 reply; 8+ messages in thread
From: mendola at gmail dot com @ 2010-08-23 16:06 UTC (permalink / raw)
  To: gcc-bugs

Hi,
compiling the following code with -Wconversion doesn't give a warning while
with compiler version 4.3.2 does. As you can verify the posted code has a real
conversion loss at runtime giving:

expected: 8000000000
obtained: 3705032704


=================================================================
#include <iostream>

void foo(unsigned int a) { std::cout << "obtained: " << a << std::endl; }

class Test {
public:
  void eval() {
    foo(bar());
  }
private:
    unsigned long long bar() const {
      unsigned long long ret = 8000000000;
      std::cout << "expected: " << ret << std::endl;
      return ret;
    }
};

int main () {
    Test t;
    t.eval();

    return 1;
}
=================================================================


-- 
           Summary: -Wconversion fails to detect a real conversion loss
           Product: gcc
           Version: 4.4.3
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: mendola at gmail dot com
 GCC build triplet: 4.4.3
  GCC host triplet: 4.4.3
GCC target triplet: 4.4.3


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2011-11-13 16:37 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-45385-4@http.gcc.gnu.org/bugzilla/>
2011-10-20  1:25 ` [Bug c++/45385] missing -Wconversion for method calls paolo.carlini at oracle dot com
2011-10-20  8:21 ` manu at gcc dot gnu.org
2011-10-20  8:28 ` paolo.carlini at oracle dot com
2011-10-20 23:57 ` [Bug c++/45385] [4.4/4.5/4.6/4.7 Regression] " paolo.carlini at oracle dot com
2011-10-21 20:02 ` paolo at gcc dot gnu.org
2011-10-21 20:03 ` [Bug c++/45385] [4.4/4.5/4.6 " paolo.carlini at oracle dot com
2011-11-13 18:18 ` paolo.carlini at oracle dot com
2010-08-23 16:06 [Bug c++/45385] New: -Wconversion fails to detect a real conversion loss mendola at gmail dot com
2010-08-25 11:12 ` [Bug c++/45385] missing -Wconversion for method calls pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).