fork(3) download
  1. template<bool Condition, typename T = void>
  2. struct EnableIf
  3. {
  4. };
  5. template<typename T>
  6. struct EnableIf<true, T>
  7. {
  8. typedef T Type;
  9. };
  10.  
  11. struct Base
  12. {
  13. static const int Foo = 0;
  14. };
  15.  
  16. template<int KeySize>
  17. struct Derived : public EnableIf<true || KeySize == 42, Base>::Type
  18. {
  19. static const int Bar = Foo;
  20. };
  21.  
  22. int main()
  23. {
  24. Derived<42> Inst;
  25. }
Compilation error #stdin compilation error #stdout 0s 3292KB
stdin
Standard input is empty
compilation info
prog.cpp:19:25: error: ‘Foo’ was not declared in this scope
  static const int Bar = Foo;
                         ^
prog.cpp: In function ‘int main()’:
prog.cpp:24:14: warning: unused variable ‘Inst’ [-Wunused-variable]
  Derived<42> Inst;
              ^
stdout
Standard output is empty