fork download
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. template <int I>
  6. struct s
  7. {
  8. string str;
  9. };
  10.  
  11. template <template<int> class T, int U>
  12. void foo(T<U>&& param)
  13. {
  14. cout << param.str << endl;
  15. }
  16.  
  17. int main()
  18. {
  19. s<5> thing;
  20. foo( thing );
  21. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function 'int main()':
prog.cpp:20:13: error: cannot bind 's<5>' lvalue to 's<5>&&'
  foo( thing );
             ^
prog.cpp:12:6: note: initializing argument 1 of 'void foo(T<U>&&) [with T = s; int U = 5]'
 void foo(T<U>&& param)
      ^
stdout
Standard output is empty