Cpp_houjie icon indicating copy to clipboard operation
Cpp_houjie copied to clipboard

代码没编译通过

Open herrhu97 opened this issue 3 years ago • 1 comments

$ g++ C++OOP2-ex.cpp
C++OOP2-ex.cpp:66:16: error: declaration of template parameter ‘T’ shadows template parameter
   66 |      template <typename T>
      |                ^~~~~~~~
C++OOP2-ex.cpp:65:12: note: template parameter ‘T’ declared here
   65 |  template <typename T,
      |            ^~~~~~~~
C++OOP2-ex.cpp:102:16: error: declaration of template parameter ‘T’ shadows template parameter
  102 |      template <typename T>
      |                ^~~~~~~~
C++OOP2-ex.cpp:101:12: note: template parameter ‘T’ declared here
  101 |  template <typename T,
      |            ^~~~~~~~
C++OOP2-ex.cpp: In function ‘void jj03::test_template_template_parameters_2()’:
C++OOP2-ex.cpp:118:16: warning: ‘template<class> class std::auto_ptr’ is deprecated [-Wdeprecated-declarations]
  118 |   XCls<double, auto_ptr> p4;
      |                ^~~~~~~~
In file included from /usr/include/c++/9/memory:80,
                 from C++OOP2-ex.cpp:6:
/usr/include/c++/9/bits/unique_ptr.h:53:28: note: declared here
   53 |   template<typename> class auto_ptr;
      |                            ^~~~~~~~

herrhu97 avatar Dec 24 '21 07:12 herrhu97

请仔细检查

harvestlamb avatar Sep 05 '22 10:09 harvestlamb