language: C++ 4.7.2 (gcc-4.7.2)
date: 830 days 1 hour ago
link:
visibility: public
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <iostream>
 
using namespace std;
 
template<unsigned int n>
struct Factorial {
    enum { value = n * Factorial<n-1>::value};
};
 
template<>
struct Factorial<0> {
    enum {value = 1};
};
 
template<int factorial> 
struct _{ operator char() { return factorial + 256; } }; //always overflow
int main() {
        char(_<Factorial<5>::value>());
        return 0;
}
 
prog.cpp: In member function ‘_<factorial>::operator char() [with int factorial = 120]’:
prog.cpp:18:   instantiated from here
prog.cpp:16: warning: overflow in implicit constant conversion