Debian Codegraph @

gcc/testsuite/g++.dg/template/pr23510.C

raw
1 // { dg-do compile }
2 // { dg-options "-ftemplate-depth-15" }
3 template<unsigned int nFactor>
4 struct Factorial
5 {
6 enum { nValue = nFactor * Factorial<nFactor - 1>::nValue }; // { dg-error "depth" }
7 };
8
9 template<>
10 struct Factorial<0>
11 {
12 enum { nValue = 1 };
13 };
14
15 static const unsigned int FACTOR = 20;
16
17 int main()
18 {
19 Factorial<FACTOR>::nValue; // { dg-message "from here" }
20 return 0;
21 }
22
23 // { dg-prune-output "compilation terminated" }