[Bug c++/88446] __builtin_is_constant_evaluated rejects some converted constant expressions.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88446 Jakub Jelinek changed: What|Removed |Added Status|ASSIGNED|RESOLVED Resolution|--- |FIXED --- Comment #7 from Jakub Jelinek --- Should be fixed now.
[Bug c++/88446] __builtin_is_constant_evaluated rejects some converted constant expressions.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88446 --- Comment #6 from Jakub Jelinek --- Author: jakub Date: Fri Dec 21 19:58:36 2018 New Revision: 267341 URL: https://gcc.gnu.org/viewcvs?rev=267341=gcc=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
[Bug c++/88446] __builtin_is_constant_evaluated rejects some converted constant expressions.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88446 --- Comment #5 from Jakub Jelinek --- Created attachment 45217 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=45217=edit gcc9-pr86524.patch Untested fix for the static_assert issue.
[Bug c++/88446] __builtin_is_constant_evaluated rejects some converted constant expressions.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88446 --- Comment #4 from Jakub Jelinek --- Author: jakub Date: Wed Dec 12 08:44:27 2018 New Revision: 267047 URL: https://gcc.gnu.org/viewcvs?rev=267047=gcc=rev Log: PR c++/88446 * cp-tree.h (maybe_constant_value): Add manifestly_const_eval argument. * constexpr.c (struct constexpr_call): Rename pretend_const_required member to manifestly_const_eval. (struct constexpr_ctx): Likewise. (constexpr_call_hasher::equal): Adjust users. (cxx_eval_builtin_function_call): Likewise. Formatting fix. (cxx_eval_call_expression): Adjust users. (cxx_eval_outermost_constant_expr, maybe_constant_init_1, maybe_constant_init): Rename pretend_const_required argument to manifestly_const_eval, adjust function comments. (maybe_constant_value): Add manifestly_const_eval argument. If true, don't cache and call cxx_eval_outermost_constant_expr with true as manifestly_const_eval. * decl.c (compute_array_index_type_loc): Call maybe_constant_value with true as manifestly_const_eval. * g++.dg/cpp2a/is-constant-evaluated3.C: New test. Added: trunk/gcc/testsuite/g++.dg/cpp2a/is-constant-evaluated3.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/constexpr.c trunk/gcc/cp/cp-tree.h trunk/gcc/cp/decl.c trunk/gcc/testsuite/ChangeLog
[Bug c++/88446] __builtin_is_constant_evaluated rejects some converted constant expressions.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88446 --- Comment #3 from Jakub Jelinek --- The static_assert bug is related to PR86524.
[Bug c++/88446] __builtin_is_constant_evaluated rejects some converted constant expressions.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88446 Jakub Jelinek changed: What|Removed |Added Status|NEW |ASSIGNED Assignee|unassigned at gcc dot gnu.org |jakub at gcc dot gnu.org --- Comment #2 from Jakub Jelinek --- Created attachment 45207 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=45207=edit gcc9-pr88446.patch Untested fix for the array type dimensions.
[Bug c++/88446] __builtin_is_constant_evaluated rejects some converted constant expressions.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88446 Jakub Jelinek changed: What|Removed |Added Status|UNCONFIRMED |NEW Last reconfirmed||2018-12-11 CC||jason at gcc dot gnu.org Ever confirmed|0 |1 --- Comment #1 from Jakub Jelinek --- And as Eric mentioned, static_assert (__builtin_is_constant_evaluated ()); should not fail either. I guess the array bounds including new are because GCC as an extension supports VLAs (though sure, outside of function contexts we reject them anyway). Jason, do you think we should handle these bounds with pretend_const_required true to cxx_eval_outermost_constant_expr, like e.g. maybe_constant_init_1 with pretend_const_required does?