Catch2: warning: declaration requires an exit-time destructor

Created on 25 Aug 2014  路  2Comments  路  Source: catchorg/Catch2

Using single_include/catch.hpp revision 85d33e2cbd5354c36000424f823fc87707a24c3c, compiling with clang++ -O0 -g -fmessage-length=0 -pedantic -std=c++11 -Wall -Wextra -Wno-c++98-compat -Weverything -c -o test2.o test2.cpp shows the warnings:

./catch.hpp:6041:32: warning: declaration requires an exit-time destructor [-Wexit-time-destructors]
        static PosixColourImpl s_instance;
                            ^
./catch.hpp:6057:37: warning: declaration requires an exit-time destructor [-Wexit-time-destructors]
                static NoColourImpl s_instance;
                                    ^
./catch.hpp:7184:33: warning: declaration requires an exit-time destructor [-Wexit-time-destructors]
        static TagAliasRegistry instance;
                                ^
test2.cpp:5:1: warning: declaration requires an exit-time destructor [-Wexit-time-destructors]
TEST_CASE("foo", "bar") {
^

Most helpful comment

OBJECTION
The issue still exists.

  • Catch version: v2.0.0-develop.3 (git hash afc0b31)
  • clang: Apple LLVM version 8.1.0 (clang-802.0.38)

Warning levels:

-Weverything
-pedantic
-pedantic-errors
-Wextra-tokens
-Wambiguous-member-template
-Wbind-to-temporary-copy
-Wno-c++98-compat

We use a workaround for clang:

#define SUPPRESS_WARNINGS_CATCH_BEGIN \
  _Pragma("clang diagnostic push")    \
      _Pragma("clang diagnostic ignored \"-Wexit-time-destructors\"")

#define SUPPRESS_WARNINGS_CATCH_END _Pragma("clang diagnostic pop")

and then we enclose all the tests into a pair of SUPPRESS_WARNINGS_CATCH_BEGIN and SUPPRESS_WARNINGS_CATCH_END.

All 2 comments

This ticket is very old (sorry I didn't respond originally). Catch has changed substantially since then - especially wrt warnings.
I suspect these issues no longer exist, so I'm marking this for closure soon, unless anyone objects?

OBJECTION
The issue still exists.

  • Catch version: v2.0.0-develop.3 (git hash afc0b31)
  • clang: Apple LLVM version 8.1.0 (clang-802.0.38)

Warning levels:

-Weverything
-pedantic
-pedantic-errors
-Wextra-tokens
-Wambiguous-member-template
-Wbind-to-temporary-copy
-Wno-c++98-compat

We use a workaround for clang:

#define SUPPRESS_WARNINGS_CATCH_BEGIN \
  _Pragma("clang diagnostic push")    \
      _Pragma("clang diagnostic ignored \"-Wexit-time-destructors\"")

#define SUPPRESS_WARNINGS_CATCH_END _Pragma("clang diagnostic pop")

and then we enclose all the tests into a pair of SUPPRESS_WARNINGS_CATCH_BEGIN and SUPPRESS_WARNINGS_CATCH_END.

Was this page helpful?
0 / 5 - 0 ratings