================
@@ -12504,6 +12514,14 @@ void Sema::CheckImplicitConversion(Expr *E, QualType
T, SourceLocation CC,
IntRange TargetRange = IntRange::forTargetOfCanonicalType(Context, Target);
if (LikelySourceRange->Width > TargetRange.Width) {
+ // Check if target is a wrapping OBT - if so, don't warn about constant
+ // conversion because wrapping behavior is defined for truncation
----------------
JustinStitt wrote:
The goal is to silence `-Wconstant-conversion` warnings when the destination
type is `__wrap`.
```c
constexpr short __wrap cx2 = 100000; // OK - wrapping destination
for (unsigned char __wrap count{300}; count < 90; ++count) {} // also OK
(even with '{}'}
```
I'll update the comment not to mention the definedness of implicit truncation
but rather the reason for silencing the diagnostic.
https://github.com/llvm/llvm-project/pull/148914
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits