[Bug 279443] LIBCPP assertions are enabled in optimized builds when -DNDEBUG is given to clang

From: <bugzilla-noreply_at_freebsd.org>
Date: Fri, 31 May 2024 23:07:22 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=279443

--- Comment #3 from Mark Millard <marklmi26-fbsd@yahoo.com> ---
cppreference.com reports the following for C only:

3) special case: & and * cancel each other, neither one is evaluated
4) special case: & and the * that is implied in [] cancel each other, only the
addition implied in [] is evaluated.

For C++ it reports:

Note that, unlike C99 and later C versions, there's no special case for the
unary operator& applied to the result of the unary operator*.

But I've not tried to see what any fairly modern C++ standard says
about such and cppreference.com is not explicit about the & and []
combination in contexts that could possibly use &*(a+i) as a valid
translation.

If cppreference.com is correct, modern C++ may well require avoiding
the &a[i] notation for the non-dereferenceable case: only use such for
dereferenceable accesses, even for for likes of std::contiguous_iterator
contexts.

Again, I'm not sure because I've not analyzed any relevant version of
the standard for the issue.

-- 
You are receiving this mail because:
You are the assignee for the bug.