view gcc/testsuite/g++.dg/template/pr23510.C @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
line wrap: on
line source

// { dg-do compile } 
// { dg-options "-ftemplate-depth-15" }
template<unsigned int nFactor>
struct Factorial
{
  enum { nValue = nFactor * Factorial<nFactor - 1>::nValue }; // { dg-error "depth" } 
};

template<>
struct Factorial<0>
{
  enum { nValue = 1 };
};

static const unsigned int FACTOR = 20;

int main()
{
  Factorial<FACTOR>::nValue;  // { dg-message "from here" }
  return 0;
}

// { dg-prune-output "compilation terminated" }