[PATCH] D25403: [CUDA] Mark __libcpp_{isnan, isinf, isfinite} as constexpr.

Marshall Clow via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 18 15:29:55 PDT 2016


mclow.lists added a comment.

In https://reviews.llvm.org/D25403#573104, @jlebar wrote:

> Likewise, should I update the documentation to indicate that check-cxx may fail with a clang built from tip of tree, due to c++17 support being experimental?  Or do you all want to change the target so that it doesn't run the c++17 tests by default?  This burned about an hour of developer time yesterday, I guess because we couldn't believe that check-cxx would be intentionally broken like that, so it would be nice to have some sort of fix.


Yesterday and today is the first time in a while that clang has been seriously broken for more than an hour or so.
I'm not inclined to worry about it yet.

>> 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.
> 
> Functions that call non-constexpr things can be marked constexpr; you just can't evaluate them in a constexpr context (as you demonstrated).
> 
> All I need is for the function to be marked as constexpr; I do not need the function be constexpr-evaluatable.

Then what's the point? How can you test if it is correct?

> I think the implications of this change would be that, if you evaluated this function in a constexpr context, before the change would be a compile error when calling __libcpp_isnan, and after this change it would be a compile error at calling ::isnan.  Since the function should not be called outside of libc++ anyway, I was hoping that wouldn't make a difference to anyone.

I guess I don't understand the motivation for this change.


https://reviews.llvm.org/D25403





More information about the cfe-commits mailing list