[PATCH] D25403: [CUDA] Mark __libcpp_{isnan, isinf, isfinite} as constexpr.
Marshall Clow via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 18 08:37:04 PDT 2016
mclow.lists added a comment.
> error: undefined reference to '__gxx_personality_v0'
means that you're not linking to an ABI library.
That symbol comes out of libc++abi, but you can also get that from libsupc.
My build setup is similar to yours (on Mac OS X):
cd $LLVM_BUILD ; rm -rf libcxx ; mkdir libcxx ; cd libcxx
CXX=$LLVM_BIN/clang++ cmake -DLLVM_PATH=$LLVM/llvm -DLIBCXX_CXX_ABI=libcxxabi -DLIBCXX_CXX_ABI_INCLUDE_PATHS=/usr/include $LIBCXX
make # build libc++
make check-libcxx # run the tests
================
Comment at: libcxx/include/cmath:615
_LIBCPP_ALWAYS_INLINE
-typename enable_if<!is_floating_point<_A1>::value, bool>::type
+_LIBCPP_CONSTEXPR typename enable_if<!is_floating_point<_A1>::value, bool>::type
__libcpp_isfinite(_A1 __lcpp_x) _NOEXCEPT
----------------
I don't see how this can possibly be constexpr.
it calls `isfinite()`, which is hoisted from `::isfinite()`, which comes from the C library.
Since C knows nothing about constexpr, we're stuck.
I just tried this:
constexpr float f = 3.2f;
static_assert(::isfinite(f), "" );
and got:
bug.cpp:9:19: error: static_assert expression is not an integral constant expression
static_assert(::isfinite(f), "" );
^~~~~~~~~~~~~
https://reviews.llvm.org/D25403
More information about the cfe-commits
mailing list