fork download
  1. #include <iostream>
  2.  
  3. template <int I1, int I2>
  4. class adder { };
  5.  
  6. template <int I1, int I2>
  7. class adder1 : public adder<I1, I2> { };
  8.  
  9. template <int I1, int I2>
  10. class adder2 : public adder<I1, I2> { };
  11.  
  12. template <typename A, int I>
  13. class fusedmultiplyadder { };
  14.  
  15. template <int i1, int i2, int i3>
  16. void foo(fusedmultiplyadder<adder<i1, i2>, i3>)
  17. {
  18. std::cout << "fma: " << i1 << ", " << i2 << ", " << i3 << std::endl;
  19. }
  20.  
  21. int main()
  22. {
  23. fusedmultiplyadder<adder1<2, 3>, 4> fma1;
  24. foo(fma1);
  25. fusedmultiplyadder<adder2<2, 3>, 4> fma2;
  26. foo(fma2);
  27. return 0;
  28. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function 'int main()':
prog.cpp:24:12: error: no matching function for call to 'foo(fusedmultiplyadder<adder1<2, 3>, 4>&)'
prog.cpp:26:12: error: no matching function for call to 'foo(fusedmultiplyadder<adder2<2, 3>, 4>&)'
stdout
Standard output is empty