This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/51478] New: constexpr not doing short-circuit evaluation


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)];


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]