ahatanak wrote: > Looks like a bug to me. This warning presumably ought to be checking whether > it's valid to read / write to the given location using something like > [`isUserWritingOffTheEnd`](https://github.com/llvm/llvm-project/blob/b2e2ae8702e9fbbe0ef0eb5929aa2d5dc867b1c5/clang/lib/AST/ExprConstant.cpp#L12699). > (But I don't think that's a bug in _this_ PR.)
Should `foo` in the following code return 4 when `-fstrict-flex-arrays` is 2 or 3 (but not when it's 0 or 1) only when the target is `-std=c++23` or newer? Or should it return 4 for older standards too? ``` struct S { int count; int array[1]; }; int foo(S &s) { return __builtin_object_size(s.array, 0); } ``` And this function should return -1 regardless of what the standard is because `s` is a pointer? ``` int foo(S *s) { return __builtin_object_size(s->array, 0); } ``` https://github.com/llvm/llvm-project/pull/95474 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits