fork download
  1. template<int N>
  2. class Y {
  3. public:
  4. template<typename C, typename... TArgs>
  5. C x(TArgs&&... args) {
  6. return C(args...);
  7. }
  8. };
  9.  
  10. struct Foo {
  11. Foo(int x, double y) {}
  12. };
  13.  
  14. template<>
  15. template<>
  16. Foo Y<0>::x<Foo>(int&& x, double&& y) = delete;
  17.  
  18. int main()
  19. {
  20. Y<0> y;
  21. y.x<Foo>(4, 2.2);
  22. }
  23.  
Compilation error #stdin compilation error #stdout 0s 3452KB
stdin
Standard input is empty
compilation info
prog.cpp: In function 'int main()':
prog.cpp:21:17: error: use of deleted function 'C Y<N>::x(TArgs&& ...) [with C = Foo; TArgs = {int, double}; int N = 0]'
  y.x<Foo>(4, 2.2);
                 ^
prog.cpp:16:5: note: declared here
 Foo Y<0>::x<Foo>(int&& x, double&& y) = delete;
     ^
stdout
Standard output is empty