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: unassig...@gcc.gnu.org
        ReportedBy: d...@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)];

Reply via email to