https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93589
John Downing changed:
What|Removed |Added
CC||jrdowning at yahoo dot com
--- Comment
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93589
--- Comment #10 from Jonathan Wakely ---
No, you've misunderstood. It doesn't mean "can, if the compiler chooses to".
There is no design decision involved.
Types smaller than int *can* be promoted to int, and in certain contexts they
*are*
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93589
--- Comment #9 from John Downing ---
(In reply to Jason Merrill from comment #7)
> Rather, it was suppressed for the simple case where the RHS has a suitable
> type. As Jonathan says, (CHAR_BIT * static_cast(i)) has type int (it
> would be
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93589
--- Comment #8 from John Downing ---
> (In reply to John Downing from comment #5)
> > This will generate a warning, for the char and short cases, when the "|="
> > happens. This is despite "val" being explicitly declared as a char or an
> >
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93589
Jason Merrill changed:
What|Removed |Added
CC||jason at gcc dot gnu.org
--- Comment #7
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93589
Jonathan Wakely changed:
What|Removed |Added
Status|RESOLVED|NEW
Last reconfirmed|
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93589
John Downing changed:
What|Removed |Added
CC||jrdowning at yahoo dot com
--- Comment
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93589
Jonathan Wakely changed:
What|Removed |Added
See Also||https://gcc.gnu.org/bugzill
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93589
Andrew Pinski changed:
What|Removed |Added
Status|UNCONFIRMED |RESOLVED
Resolution|---
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93589
--- Comment #2 from Lokesh Janghel ---
>Note your example code does not match the warning message you have in comment
>#0.
Sorry, I used some reduce test case. here is the correct one:
$ g++ -Wconversion test.cpp
test.cpp: In instantiation of
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93589
--- Comment #1 from Andrew Pinski ---
I don't see the issue here due to promotion rules in C++.
Note your example code does not match the warning message you have in comment
#0.
Just add an extra cast:
static_cast((CHAR_BIT * static_cast(i)) <<
11 matches
Mail list logo