eranpeer / FakeIt

C++ mocking made easy. A simple yet very expressive, headers only library for c++ mocking.
MIT License
1.24k stars 173 forks source link

Use of deprecated uncaught_exception #157

Closed dumarjo closed 3 years ago

dumarjo commented 6 years ago

Hi, Since C++17 the uncaught_exception functions has been deprecated. The new signature of the function is as follow int uncaught_exceptions() instead of bool uncaught_exception()

When compiling wiht gcc 8.0.1 a warning is generated like this

In file included from ../../TESTS/DummyTest.cpp:22:
../../TESTS/../Externals/FakeIt/single_header/catch/fakeit.hpp:9086:45: warning: 'bool std::uncaught_exception()' is deprecated [-Wdeprecated-declarations]
                 if (std::uncaught_exception()) {
                                             ^
In file included from E:/Scoop/apps/gcc/current/lib/gcc/i686-w64-mingw32/8.1.0/include/c++/new:40,
                 from E:/Scoop/apps/gcc/current/lib/gcc/i686-w64-mingw32/8.1.0/include/c++/ext/new_allocator.h:33,
                 from E:/Scoop/apps/gcc/current/lib/gcc/i686-w64-mingw32/8.1.0/include/c++/i686-w64-mingw32/bits/c++allocator.h:33,
                 from E:/Scoop/apps/gcc/current/lib/gcc/i686-w64-mingw32/8.1.0/include/c++/bits/allocator.h:46,
                 from E:/Scoop/apps/gcc/current/lib/gcc/i686-w64-mingw32/8.1.0/include/c++/string:41,
                 from ../../Externals/Catch2/single_include/catch2/catch.hpp:315,
                 from ../../TESTS/DummyTest.cpp:21:
E:/Scoop/apps/gcc/current/lib/gcc/i686-w64-mingw32/8.1.0/include/c++/exception:102:8: note: declared here
   bool uncaught_exception() _GLIBCXX_USE_NOEXCEPT __attribute__ ((__pure__));
        ^~~~~~~~~~~~~~~~~~

}

To remove the warning I use the -Wno-deprecated flags.

Regards

Jonathan

helmesjo commented 5 years ago

Yep, this would be nice to have fixed.

conradjones commented 5 years ago

Fixed https://github.com/eranpeer/FakeIt/pull/176

milbrandt commented 3 years ago

not fixed for Visual Studio 2019, there is __cplusplus == 199711L

FranckRJ commented 3 years ago

Should be fixed by https://github.com/eranpeer/FakeIt/pull/228.

FranckRJ commented 3 years ago

Fix released in 2.0.7.