[Bug c++/86524] [8/9 Regression] std::less with pointer arguments not usable in static_assert in constexpr function

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Dec 21 19:59:00 GMT 2018


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86524

--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Author: jakub
Date: Fri Dec 21 19:58:36 2018
New Revision: 267341

URL: https://gcc.gnu.org/viewcvs?rev=267341&root=gcc&view=rev
Log:
        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.

Added:
    trunk/gcc/testsuite/g++.dg/cpp1y/constexpr-86524.C
    trunk/gcc/testsuite/g++.dg/cpp2a/is-constant-evaluated4.C
    trunk/gcc/testsuite/g++.dg/cpp2a/is-constant-evaluated5.C
    trunk/gcc/testsuite/g++.dg/cpp2a/is-constant-evaluated6.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/constexpr.c
    trunk/gcc/cp/cp-gimplify.c
    trunk/gcc/cp/cp-tree.h
    trunk/gcc/cp/semantics.c
    trunk/gcc/testsuite/ChangeLog


More information about the Gcc-bugs mailing list