https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69864
--- Comment #7 from Jonathan Wakely ---
(In reply to Manuel López-Ibáñez from comment #4)
> (In reply to Jakub Jelinek from comment #3)
> > Or use -pedantic-errors.
>
> I find it a bit ironic that Clang does inform the user when something is
> a
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69864
--- Comment #6 from Jonathan Wakely ---
Because int b{2.3} absolutely definitely loses precision, and since it's a
constant you can just fix the code.
For {u} the compiler doesn't know whether it really narrows or not, since it
depends on un tim
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69864
--- Comment #5 from mgsergio ---
And what about the inconsistency with compilation error on
int main() {
int b{2.3};
}
In that case an error is generated.
And if I use
template
inline T narrowing_check(U const u)
{
return {u};
}
I get a
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69864
Manuel López-Ibáñez changed:
What|Removed |Added
CC||manu at gcc dot gnu.org
Re
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69864
Jakub Jelinek changed:
What|Removed |Added
CC||jakub at gcc dot gnu.org
--- Comment #3
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69864
Markus Trippelsdorf changed:
What|Removed |Added
Status|UNCONFIRMED |RESOLVED
CC|
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69864
--- Comment #1 from mgsergio ---
*gcc emits a warning on narrowing_check although an error should be generated
instead.