prog.cpp: In function ‘int main()’:
prog.cpp:17:7: error: the value of ‘bar’ is not usable in a constant expression
func<bar>(); // und bar deshalb hier kein konstanter Ausdruck ist
^
prog.cpp:8:11: note: ‘bar’ was not initialized with a constant expression
const int bar = foo::constant + 1; // hier weiß der Compiler das aber noch nicht...
^
prog.cpp:17:12: error: no matching function for call to ‘func()’
func<bar>(); // und bar deshalb hier kein konstanter Ausdruck ist
^
prog.cpp:17:12: note: candidate is:
prog.cpp:13:6: note: template<int i> void func()
void func();
^
prog.cpp:13:6: note: template argument deduction/substitution failed:
prog.cpp:17:12: error: the value of ‘bar’ is not usable in a constant expression
func<bar>(); // und bar deshalb hier kein konstanter Ausdruck ist
^
prog.cpp:8:11: note: ‘bar’ was not initialized with a constant expression
const int bar = foo::constant + 1; // hier weiß der Compiler das aber noch nicht...
^
prog.cpp:17:12: note: in template argument for type ‘int’
func<bar>(); // und bar deshalb hier kein konstanter Ausdruck ist
^