OSDN Git Service

/cp
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.dg / template / pr23510.C
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 exceeds maximum" } 
7   // { dg-message "recursively required" "" { target *-*-* } 6 }
8   // { dg-error "incomplete type" "" { target *-*-* } 6 } 
9 } // { dg-error "expected ';' after" }
10
11   template<>
12   struct Factorial<0>
13   {
14     enum { nValue = 1 };
15   };
16
17     static const unsigned int FACTOR = 20;
18
19 int main()
20 {
21   Factorial<FACTOR>::nValue;
22   return 0;
23 }