This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

long int / int assignment warnings


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]