[all-commits] [llvm/llvm-project] 4ede88: PR45402: Make the restrictions on constant evaluat...

Richard Smith via All-commits all-commits at lists.llvm.org
Fri Apr 3 18:26:51 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 4ede8879924c08ae5b495d3f421c167d822a60be
      https://github.com/llvm/llvm-project/commit/4ede8879924c08ae5b495d3f421c167d822a60be
  Author: Richard Smith <richard at metafoo.co.uk>
  Date:   2020-04-03 (Fri, 03 Apr 2020)

  Changed paths:
    M clang/docs/LanguageExtensions.rst
    M clang/include/clang/Basic/DiagnosticASTKinds.td
    M clang/lib/AST/ExprConstant.cpp
    M clang/test/SemaCXX/constexpr-string.cpp

  Log Message:
  -----------
  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.




More information about the All-commits mailing list