HomePhabricator

PR45402: Make the restrictions on constant evaluation of memcmp and memchr…

Authored by rsmith on Apr 3 2020, 6:22 PM.

Description

PR45402: Make the restrictions on constant evaluation of memcmp and memchr consistent and comprehensible, and document them.

We previously allowed evaluation of memcmp on arrays of integers of any
size, so long as the call evaluated to 0, and allowed evaluation of
memchr on any array of integral type of size 1 (including enums). The
purpose of constant-evaluating these builtins is only to support
constexpr std::char_traits, so we now consistently allow them on arrays
of (possibly signed or unsigned) char only.

Details