[libcxx] r285572 - 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 07:14:13 PDT 2016


Author: rogfer01
Date: Mon Oct 31 09:14:13 2016
New Revision: 285572

URL: http://llvm.org/viewvc/llvm-project?rev=285572&view=rev
Log:
Fix archetypes.hpp under libcpp-no-extensions and std level < 14

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.

Use a comma operator to workaround this problem.

Differential Revision: https://reviews.llvm.org/D26147


Modified:
    libcxx/trunk/test/support/archetypes.hpp

Modified: libcxx/trunk/test/support/archetypes.hpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/archetypes.hpp?rev=285572&r1=285571&r2=285572&view=diff
==============================================================================
--- libcxx/trunk/test/support/archetypes.hpp (original)
+++ libcxx/trunk/test/support/archetypes.hpp Mon Oct 31 09:14:13 2016
@@ -147,7 +147,7 @@ struct ValueBase {
 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;
@@ -155,7 +155,7 @@ protected:
     }
     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;




More information about the cfe-commits mailing list