• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 // Check that the overloads of std::__libcpp_{isnan,isinf,isfinite} that take
10 // floating-point values are evaluatable from constexpr contexts.
11 //
12 // These functions need to be constexpr in order to be called from CUDA, see
13 // https://reviews.llvm.org/D25403.  They don't actually need to be
14 // constexpr-evaluatable, but that's what we check here, since we can't check
15 // true constexpr-ness.
16 //
17 // UNSUPPORTED: c++03
18 
19 #include <cmath>
20 
21 #include "test_macros.h"
22 
23 static_assert(std::__constexpr_isnan(0.) == false, "");
24 static_assert(std::__constexpr_isinf(0.0) == false, "");
25 static_assert(std::__constexpr_isfinite(0.0) == true, "");
26 
main(int,char **)27 int main(int, char**)
28 {
29 
30   return 0;
31 }
32