fork download
  1. struct Dummy {
  2. static Dummy DUMMYvoid(void) { return Dummy(); }
  3.  
  4. typedef Dummy (*voidCreator)(void);
  5. template <voidCreator> void get() const; //17
  6. template<> void get<&DUMMYvoid>() const {}
  7.  
  8. static Dummy DUMMYint(int) { return Dummy(); }
  9.  
  10. typedef Dummy (*intCreator)(int);
  11. template <intCreator> int get() const;
  12. template<> int get<&DUMMYint>() const { return 0; } //24
  13. };
  14.  
  15.  
  16. int main()
  17. {
  18. auto di = Dummy::DUMMYint(10);
  19. auto x = Dummy().get<Dummy::DUMMYint>(); //line 46
  20. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:6:12: error: explicit specialization in non-namespace scope 'struct Dummy'
prog.cpp:6:37: error: template-id 'get<Dummy::DUMMYvoid>' in declaration of primary template
prog.cpp:11:29: error: too many template-parameter-lists
prog.cpp:12:12: error: explicit specialization in non-namespace scope 'struct Dummy'
prog.cpp:12:35: error: template-id 'get<Dummy::DUMMYint>' in declaration of primary template
prog.cpp:12:18: error: 'int Dummy::get() const' cannot be overloaded
prog.cpp:6:19: error: with 'void Dummy::get() const'
prog.cpp: In function 'int main()':
prog.cpp:19:41: error: no matching function for call to 'Dummy::get()'
prog.cpp:19:41: error: unable to deduce 'auto' from '<expression error>'
stdout
Standard output is empty