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: "david at doublewise dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 08 Sep 2012 21:36:10 +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
David Stone <david at doublewise dot net> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |david at doublewise dot net
--- Comment #5 from David Stone <david at doublewise dot net> 2012-09-08 21:36:10 UTC ---
I'm running into some issues with this bug, and it's much broader than the test
cases suggest. On gcc 4.7.0, this is what happens:
int main() {
int x = 0;
// This assigns false to a:
bool const a = __builtin_constant_p(x);
// This assigns true to b:
bool const b = __builtin_constant_p(__builtin_constant_p(x));
// This causes "error: the value of 'x' is not usable in a constant
expression"
constexpr bool c = __builtin_constant_p(x);
}