[clang] [lldb] [Clang] Introduce OverflowBehaviorType for fine-grained overflow control (PR #148914)
Justin Stitt via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 24 12:22:57 PDT 2025
================
@@ -9744,6 +9744,16 @@ static void DiagnoseNarrowingInInitList(Sema &S,
case NK_Constant_Narrowing: {
// A constant value was narrowed.
+
+ // Overflow behavior destination types with a 'wrap' kind can elide
----------------
JustinStitt wrote:
Without the OBT check in the diagnostic logic we get the following warning:
```c
constexpr short __ob_wrap cx2 = {100000}; // constant expression evaluates to 100000 which cannot be narrowed to type '__ob_wrap short'
```
And I didn't want this to be the case for wrapping things. So it is just a design decisions really. It is consistent with the `-fsanitize=implicit-unsigned-integer-truncation` handling too. I just really want free reign over bit boundary stuff with `__ob_wrap` types.
It should be noted the OBT check only cares about the destination type.
https://github.com/llvm/llvm-project/pull/148914
More information about the cfe-commits
mailing list