Reinstate r359059, reverted in r359361, with a fix to properly prevent
authorRichard Smith <richard-llvm@metafoo.co.uk>
Sat, 27 Apr 2019 02:58:17 +0000 (02:58 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Sat, 27 Apr 2019 02:58:17 +0000 (02:58 +0000)
commit31cfb311c5cbd94963d21a76be8b7c3bec1419cc
tree0f7ab80647df4e36c40232462e3b8726cb6553b3
parentae01981d03e51173cbfd328b62b22988f1eeb751
Reinstate r359059, reverted in r359361, with a fix to properly prevent
us emitting the operand of __builtin_constant_p if it has side-effects.

Original commit message:

Fix interactions between __builtin_constant_p and constexpr to match
current trunk GCC.

GCC permits information from outside the operand of
__builtin_constant_p (but in the same constant evaluation context) to be
used within that operand; clang now does so too. A few other minor
deviations from GCC's behavior showed up in my testing and are also
fixed (matching GCC):
  * Clang now supports nullptr_t as the argument type for
    __builtin_constant_p
    * Clang now returns true from __builtin_constant_p if called with a
    null pointer
    * Clang now returns true from __builtin_constant_p if called with an
    integer cast to pointer type

llvm-svn: 359367
clang/lib/AST/ExprConstant.cpp
clang/lib/CodeGen/CGBuiltin.cpp
clang/lib/Sema/SemaChecking.cpp
clang/test/CodeGen/builtin-constant-p.c
clang/test/SemaCXX/builtin-constant-p.cpp [new file with mode: 0644]
clang/test/SemaCXX/enable_if.cpp