[Bug c++/51478] New: constexpr not doing short-circuit evaluation
dave@boost-consulting.com
gcc-bugzilla@gcc.gnu.org
Fri Dec 9 04:34:00 GMT 2011
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)];
More information about the Gcc-bugs
mailing list