Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorAndrew Gaspar2020-04-09 17:52:33 -0600
committerMartin Hořeňovský2020-05-01 09:31:59 +0200
commitca27b0dcc5061b431d2082e6f344ee0e3525ac86 (patch)
tree693d24a2a245e5f879037e05c583726ef6cab48e /src
parent87c80551769f4e9f5c10aca764080a4cf1dbd87a (diff)
downloadcatch3-ca27b0dcc5061b431d2082e6f344ee0e3525ac86.tar.gz
Remove usage of __builtin_constant_p under IBM XL
Diffstat (limited to 'src')
-rw-r--r--src/catch2/internal/catch_compiler_capabilities.hpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/catch2/internal/catch_compiler_capabilities.hpp b/src/catch2/internal/catch_compiler_capabilities.hpp
index f677c43f..8c3400f5 100644
--- a/src/catch2/internal/catch_compiler_capabilities.hpp
+++ b/src/catch2/internal/catch_compiler_capabilities.hpp
@@ -66,7 +66,20 @@
# define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION _Pragma( "clang diagnostic push" )
# define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION _Pragma( "clang diagnostic pop" )
+// As of this writing, IBM XL's implementation of __builtin_constant_p has a bug
+// which results in calls to destructors being emitted for each temporary,
+// without a matching initialization. In practice, this can result in something
+// like `std::string::~string` being called on an uninitialized value.
+//
+// For example, this code will likely segfault under IBM XL:
+// ```
+// REQUIRE(std::string("12") + "34" == "1234")
+// ```
+//
+// Therefore, `CATCH_INTERNAL_IGNORE_BUT_WARN` is not implemented.
+# if !defined(__ibmxl__)
# define CATCH_INTERNAL_IGNORE_BUT_WARN(...) (void)__builtin_constant_p(__VA_ARGS__) /* NOLINT(cppcoreguidelines-pro-type-vararg) */
+# endif
# define CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \