fork(2) download
  1. #include <iostream>
  2. #include <cstddef>
  3.  
  4. int templateParam;
  5.  
  6. template <int &D> struct TestTemplate {
  7. int value() {}
  8. };
  9.  
  10. template <> int TestTemplate<templateParam>::value() {
  11. return templateParam;
  12. }
  13.  
  14. TestTemplate<templateParam> testVariable;
  15.  
  16. int main() {
  17.  
  18. std::cout << testVariable.value() << "\n";
  19.  
  20. return 0;
  21. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:10:17: error: prototype for 'int TestTemplate<D>::value() [with int& D = (* & templateParam)]' does not match any in class 'TestTemplate<(* & templateParam)>'
 template <> int TestTemplate<templateParam>::value() {
                 ^
prog.cpp:7:9: error: candidate is: int TestTemplate<D>::value() [with int& D = (* & templateParam)]
     int value() {}
         ^
stdout
Standard output is empty