fork download
  1. #include <iostream>
  2.  
  3. class Foo {
  4. public:
  5. Foo(){};
  6.  
  7. template<typename T>
  8. Foo (T&) {
  9. std::cout << "template" << std::endl;
  10. }
  11.  
  12. //Foo(Foo&) {
  13. // std::cout << "copy" << std::endl;
  14. //}
  15.  
  16. Foo(const Foo&) {
  17. std::cout << "copy2" << std::endl;
  18. }
  19. };
  20.  
  21.  
  22. int main(){
  23. const Foo f;
  24.  
  25. Foo f2 (f);
  26.  
  27. }
Success #stdin #stdout 0s 3140KB
stdin
Standard input is empty
stdout
copy2