This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/54021] [c++0x] __builtin_constant_p should be constexpr
- From: "jakub at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 19 Jul 2012 07:12:18 +0000
- Subject: [Bug c++/54021] [c++0x] __builtin_constant_p should be constexpr
- Auto-submitted: auto-generated
- References: <bug-54021-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54021
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-07-19 07:12:18 UTC ---
Perhaps the C++ FE could when parsing a constexpr function during
finish_call_expr of __builtin_constant_p just temporarily force optimize = 1
if it is zero to prevent folding it to 0 (or alternatively, if it folds to 0,
build it non-folded), it would be an extension over how this builtin behaves
right now, on the other side as constexpr is "optimized" even at -O0 it would
match the intent of the builtin. The question is if/when it will be actually
folded to 0 afterwards if not in constexpr context.