https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85861

--- Comment #14 from Jonny Grant <jg at jguk dot org> ---

It would be useful to see the size in bits of each conversion, could that be
added?

Currently it shows:

$ g++-8 -Wall -Wextra -Wsign-conversion -o size_t size_t.cpp
size_t.cpp: In function ‘int main()’:
size_t.cpp:14:19: warning: conversion to ‘size_t’ {aka ‘long unsigned int’}
from ‘int’ may change the sign of the result [-Wsign-conversion]
     size_t big2 = smaller;
                   ^~~~~~~
size_t.cpp:19:18: warning: conversion to ‘size_t’ {aka ‘long unsigned int’}
from ‘int’ may change the sign of the result [-Wsign-conversion]
     size_t in2 = in;
                  ^~


It would be useful as:

size_t.cpp: In function ‘int main()’:
size_t.cpp:14:19: warning: conversion to 64bit ‘size_t’ {aka ‘long unsigned
int’} from 32bit ‘int’ may change the sign of the result [-Wsign-conversion]
     size_t big2 = smaller;
                   ^~~~~~~
The warning is only about the loss of signed, not about the width in fields of
the conversion at present.

Reply via email to