[libcxx-commits] [libcxx] r373328 - [libc++] Harden usage of static_assert against C++03

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Tue Oct 1 05:12:21 PDT 2019


Author: ldionne
Date: Tue Oct  1 05:12:21 2019
New Revision: 373328

URL: http://llvm.org/viewvc/llvm-project?rev=373328&view=rev
Log:
[libc++] Harden usage of static_assert against C++03

In C++03, we emulate static_assert with a macro, and we must parenthesize
multiple arguments.

Modified:
    libcxx/trunk/include/cmath

Modified: libcxx/trunk/include/cmath
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/cmath?rev=373328&r1=373327&r2=373328&view=diff
==============================================================================
--- libcxx/trunk/include/cmath (original)
+++ libcxx/trunk/include/cmath Tue Oct  1 05:12:21 2019
@@ -644,8 +644,8 @@ _LIBCPP_CONSTEXPR _IntT __max_representa
   static_assert(is_floating_point<_FloatT>::value, "must be a floating point type");
   static_assert(is_integral<_IntT>::value, "must be an integral type");
   static_assert(numeric_limits<_FloatT>::radix == 2, "FloatT has incorrect radix");
-  static_assert(_IsSame<_FloatT, float>::value || _IsSame<_FloatT, double>::value
-               || _IsSame<_FloatT,long double>::value, "unsupported floating point type");
+  static_assert((_IsSame<_FloatT, float>::value || _IsSame<_FloatT, double>::value
+                 || _IsSame<_FloatT,long double>::value), "unsupported floating point type");
   return _FloatBigger ? numeric_limits<_IntT>::max() :  (numeric_limits<_IntT>::max() >> _Bits << _Bits);
 }
 




More information about the libcxx-commits mailing list