blob: 1c3180f8331fdcf9b8596b7f209350959ed8b884 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
// { dg-do compile }
// { dg-options "-ftemplate-depth-15" }
template<unsigned int nFactor>
struct Factorial
{
enum { nValue = nFactor * Factorial<nFactor - 1>::nValue }; // { dg-error "depth exceeds maximum" }
// { dg-message "recursively instantiated" "" { target *-*-* } 6 }
// { dg-error "incomplete type" "" { target *-*-* } 6 }
} // { dg-error "expected ';' after" }
template<>
struct Factorial<0>
{
enum { nValue = 1 };
};
static const unsigned int FACTOR = 20;
int main()
{
Factorial<FACTOR>::nValue;
return 0;
}
|