re PR c++/86524 (std::less with pointer arguments not usable in static_assert in...
authorJakub Jelinek <jakub@redhat.com>
Fri, 21 Dec 2018 19:58:36 +0000 (20:58 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 21 Dec 2018 19:58:36 +0000 (20:58 +0100)
commit4cd3e7df0b7dc202d10ed7935918f1194adfc514
treeed1257ff8ce1315fa49456373bd5eb9b09f61635
parentdca00617224cd24ba52555266d9d25f95fcb3fc4
re PR c++/86524 (std::less with pointer arguments not usable in static_assert in constexpr function)

PR c++/86524
PR c++/88446
* cp-tree.h (cp_fold_maybe_rvalue, cp_fold_rvalue): Declare.
(fold_non_dependent_expr): Add manifestly_const_eval argument.
* constexpr.c (cxx_eval_builtin_function_call): Evaluate
__builtin_constant_p if ctx->manifestly_const_eval even in constexpr
functions.  Don't reuse dummy{1,2} vars between different arguments.
Use cp_fold_rvalue instead of cp_fully_fold.  Fix comment typo.
(fold_non_dependent_expr): Add manifestly_const_eval argument, pass
it through to cxx_eval_outermost_constant_expr and
maybe_constant_value.
* cp-gimplify.c (cp_fold_maybe_rvalue, cp_fold_rvalue): No longer
static.
* semantics.c (finish_static_assert): Call fold_non_dependent_expr
with true as manifestly_const_eval.

* g++.dg/cpp1y/constexpr-86524.C: New test.
* g++.dg/cpp2a/is-constant-evaluated4.C: New test.
* g++.dg/cpp2a/is-constant-evaluated5.C: New test.
* g++.dg/cpp2a/is-constant-evaluated6.C: New test.

From-SVN: r267341
gcc/cp/ChangeLog
gcc/cp/constexpr.c
gcc/cp/cp-gimplify.c
gcc/cp/cp-tree.h
gcc/cp/semantics.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp1y/constexpr-86524.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp2a/is-constant-evaluated4.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp2a/is-constant-evaluated5.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp2a/is-constant-evaluated6.C [new file with mode: 0644]