This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/51478] New: constexpr not doing short-circuit evaluation
- From: "dave at boost-consulting dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 09 Dec 2011 03:48:59 +0000
- Subject: [Bug c++/51478] New: constexpr not doing short-circuit evaluation
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51478
Bug #: 51478
Summary: constexpr not doing short-circuit evaluation
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: dave@boost-consulting.com
This program should compile, but instead it blows the instantiation stack.
template <int recurse = 0>
constexpr int factorial(int n)
{
return n ? n * factorial<recurse+1>(n - 1) : 1;
}
int array[factorial<>(6)];