blob: 7163e30ba2363e290bb6d78df92cf8896504ef2c (
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" "exceeds" }
// { dg-message "recursively required" "recurse" { target *-*-* } 6 }
// { dg-error "incomplete type" "incomplete" { 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;
}
|