Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unittest generates warning with C++17 regarding auto_ptr #335

Closed
NeroBurner opened this issue Jul 2, 2018 · 0 comments
Closed

Unittest generates warning with C++17 regarding auto_ptr #335

NeroBurner opened this issue Jul 2, 2018 · 0 comments

Comments

@NeroBurner
Copy link
Contributor

NeroBurner commented Jul 2, 2018

When compiling with C++17 enabled gcc throws the following warning:

[ 76%] Building CXX object CMakeFiles/utilities_unittest.dir/src/utilities_unittest.cc.obj
/usr/src/app/src/logging_unittest.cc: In function 'void TestDCHECK()':
/usr/src/app/src/logging_unittest.cc:575:3: warning: 'template<class> class std::auto_ptr' is deprecated [-Wdeprecated-declarations]
   auto_ptr<int64> sptr(new int64);
   ^~~~~~~~
In file included from /usr/lib/gcc/x86_64-w64-mingw32/7.3-win32/include/c++/bits/locale_conv.h:41:0,
                 from /usr/lib/gcc/x86_64-w64-mingw32/7.3-win32/include/c++/locale:43,
                 from /usr/lib/gcc/x86_64-w64-mingw32/7.3-win32/include/c++/iomanip:43,
                 from /usr/src/app/src/logging_unittest.cc:44:
/usr/lib/gcc/x86_64-w64-mingw32/7.3-win32/include/c++/bits/unique_ptr.h:51:28: note: declared here
   template<typename> class auto_ptr;
                            ^~~~~~~~

For a full build output see the following log: https://travis-ci.org/NeroBurner/glog/jobs/399043400

With MSVC 2017 and C++17 enabled the build throws an error (full log https://ci.appveyor.com/project/NeroBurner/glog/build/1.0.111/job/dl21jws89k12c66u#L266)

ClCompile:
  C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.14.26428\bin\HostX86\x64\CL.exe /c /I"C:\projects\glog\_build_vs-15-2017-win64-cxx17_Debug" /IC:\projects\glog\src /IC:\projects\glog\src\windows /I"C:\Tools\vcpkg\installed\x64-windows\include" /Zi /nologo /W3 /WX- /diagnostics:classic /Od /Ob0 /D WIN32 /D _WINDOWS /D GLOG_NO_ABBREVIATED_SEVERITIES /D GOOGLE_GLOG_DLL_DECL= /D "CMAKE_INTDIR=\"Debug\"" /D _MBCS /Gm- /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /GR /std:c++17 /Fo"logging_unittest.dir\Debug\\" /Fd"logging_unittest.dir\Debug\vc141.pdb" /Gd /TP /FC /errorReport:queue C:\projects\glog\src\logging_unittest.cc
  logging_unittest.cc
c:\projects\glog\src\logging_unittest.cc(575): error C2065: 'auto_ptr': undeclared identifier [C:\projects\glog\_build_vs-15-2017-win64-cxx17_Debug\logging_unittest.vcxproj]

edit: Just using unique_ptr fixes the warning and compilation for C++11 and above, but breaks the test for C++98 and below

@NeroBurner NeroBurner changed the title Unittest generates warning with C++17 Unittest generates warning with C++17 regarding auto_ptr Jul 2, 2018
@sergiud sergiud closed this as completed Mar 30, 2021
@sergiud sergiud mentioned this issue May 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants