This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
C++ - compilation error for all implicit conversion
- From: Satya Prakash Prasad <satyaprakash dot prasad at gmail dot com>
- To: gcc at gcc dot gnu dot org
- Date: Mon, 5 Mar 2018 13:12:43 +0530
- Subject: C++ - compilation error for all implicit conversion
- Authentication-results: sourceware.org; auth=none
Is there a compiler flag that logs warning / error in case of any implicit
conversions - like int32_t to uint32_t.
#include <cstdint>
#include <iostream>
using ::std::int32_t;
using ::std::uint32_t;
int main(int argc, char *argv[])
{
int32_t x = 9;
uint32_t i = x;
uint32_t i1 = socketread(...); // returns int32_t -1 on error and >0
on success
std::cout << " " << x << " " << i << std::flush << std::endl;
return 0;
}
c++ -std=c++11 -Wall -Wconversion -Wpedantic cast.cpp
I get no issues / warning / error during compilation - is there a way it
can achieved.