[PATCH] D26147: Fix archetypes.hpp under libcpp-no-extensions and std level < 14
Roger Ferrer Ibanez via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 31 06:55:09 PDT 2016
rogfer01 created this revision.
rogfer01 added reviewers: EricWF, mclow.lists, rmaprath.
rogfer01 added a subscriber: cfe-commits.
Under -fno-exceptions TEST_THROW becomes abort / __builtin_abort which returns void. This causes a type mismatch in the conditional operator when testing the library in C++98,03,11 modes.
This patch uses a comma operator to workaround this problem.
https://reviews.llvm.org/D26147
Files:
test/support/archetypes.hpp
Index: test/support/archetypes.hpp
===================================================================
--- test/support/archetypes.hpp
+++ test/support/archetypes.hpp
@@ -147,15 +147,15 @@
protected:
constexpr static int check_value(int const& val) {
#if TEST_STD_VER < 14
- return val == -1 || val == 999 ? TEST_THROW(42) : val;
+ return val == -1 || val == 999 ? (TEST_THROW(42), 0) : val;
#else
assert(val != -1); assert(val != 999);
return val;
#endif
}
constexpr static int check_value(int& val, int val_cp = 0) {
#if TEST_STD_VER < 14
- return val_cp = val, val = -1, (val_cp == -1 || val_cp == 999 ? TEST_THROW(42) : val_cp);
+ return val_cp = val, val = -1, (val_cp == -1 || val_cp == 999 ? (TEST_THROW(42), 0) : val_cp);
#else
assert(val != -1); assert(val != 999);
val_cp = val;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26147.76393.patch
Type: text/x-patch
Size: 858 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161031/0798eb6f/attachment.bin>
More information about the cfe-commits
mailing list