fork download
  1. #include <iostream>
  2.  
  3. namespace N {
  4. class C {};
  5.  
  6. template<typename X>
  7. char const * found(X && x) {
  8. return "found";
  9. }
  10.  
  11. template<typename, typename X>
  12. char const * notfound(X && x) {
  13. return "not found";
  14. }
  15. }
  16.  
  17. int main() {
  18. N::C object;
  19. std::cout
  20. << found(object) << std::endl
  21. << notfound<bool>(object) << std::endl
  22. << notfound<bool, N::C>(object) << std::endl;
  23. }
Compilation error #stdin compilation error #stdout 0s 15240KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:21:6: error: ‘notfound’ was not declared in this scope
   << notfound<bool>(object) << std::endl
      ^~~~~~~~
prog.cpp:21:6: note: suggested alternative:
prog.cpp:12:15: note:   ‘N::notfound’
  char const * notfound(X && x) {
               ^~~~~~~~
prog.cpp:21:15: error: expected primary-expression before ‘bool’
   << notfound<bool>(object) << std::endl
               ^~~~
stdout
Standard output is empty