-
Notifications
You must be signed in to change notification settings - Fork 15.3k
Description
An interesting case was encountered where conversions from larger bit-width integers to smaller bit-width ones is generally reported by -Wimplicit-int-conversion (32 to 16, 16 to 8, 128 to 64, etc.) except for 64 to 32, which was given its own warning: -Wshorten-64-to-32.
See http://godbolt.org/z/6q4GMPsxs. Lines 19 (uint64_t -> uint32_t) and 35 (int64_t -> int32_t) are not warned about, unless "Compiler 2"'s warning is enabled.
Although -Weverything enables both of them at the same time (and neither is enabled by default, AFAIK), it is strange that 64->32 is such a specific dedicated case.
Unfortunately, all I could track down was commit 263a48b where this warning was introduced, and that is ancient, but history runs dry at that point.
CC @dwblaikie, @rjmccall. Your names appeared in the relevant code path.
What would be the cons against enabling -Wshorten-64-to-32 under -Wimplicit-int-conversion implicitly?