This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
long int / int assignment warnings
- From: andre maute <andre dot maute at gmx dot de>
- To: gcc-help at gcc dot gnu dot org
- Date: Sun, 01 Jun 2014 16:11:03 +0200
- Subject: long int / int assignment warnings
- Authentication-results: sourceware.org; auth=none
Hi list,
my g++ is
gcc version 4.8.2 20131212 (Red Hat 4.8.2-7) (GCC)
-Wconversion will issue a warning for the second cout line
Is there a compiler flag to force a warning for the first cout line?
------------------------------------
// compile with -std=c++11 -Wconversion
#include <iostream>
#include <cstdint>
int main()
{
{ int32_t x = 1; int64_t y = x; std::cout << y << std::endl; }
{ int64_t x = 2; int32_t y = x; std::cout << y << std::endl; }
return 0;
}
-------------------------------------
Andre