This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/55077] implement and enable by default -Wliteral-conversion
- From: "egallager at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 20 Feb 2018 10:29:17 +0000
- Subject: [Bug c++/55077] implement and enable by default -Wliteral-conversion
- Auto-submitted: auto-generated
- References: <bug-55077-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55077
Eric Gallager <egallager at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |diagnostic
CC| |egallager at gcc dot gnu.org
--- Comment #7 from Eric Gallager <egallager at gcc dot gnu.org> ---
Combining the 2 testcases from this bug, I get the following output now:
$ $ cat 55077.c && /usr/local/bin/gcc -c -Wall -Wextra -pedantic -Wconversion
-Wdouble-promotion 55077.c
static const int c = 3.1415926;
int x = 24 * 0.5;
int y = (24*60*60) * 0.25;
int pennies = 123.45 * 100;
55077.c:1:22: warning: conversion from 'double' to 'int' changes value from
'3.1415926000000001e+0' to '3' [-Wfloat-conversion]
static const int c = 3.1415926;
^~~~~~~~~
55077.c:1:18: warning: 'c' defined but not used [-Wunused-const-variable=]
static const int c = 3.1415926;
^
$
So it shows the values before/after now; still might want to split off a
separate -Wliteral-conversion flag though.