This repository has been archived by the owner on Mar 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 187
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a test for and WAR'd the clang&C++11 constant eval builtin, tes…
…t may need to be moved.
- Loading branch information
Showing
2 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
.upstream-tests/test/std/utilities/utilities.general/broken_constant_eval.pass.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// This test serves as a canary for when this issue is fixed in NVCC | ||
// | ||
// UNSUPPORTED: windows, icc, pgi | ||
// XFAIL: clang-9 && c++11 | ||
// XFAIL: clang-10 && c++11 | ||
// XFAIL: gcc-9 && c++11 | ||
// XFAIL: gcc-10 && c++11 | ||
|
||
|
||
#if defined(__has_builtin) | ||
#if __has_builtin(__builtin_is_constant_evaluated) | ||
#define BUILTIN_CONSTANT_EVAL() __builtin_is_constant_evaluated() | ||
#endif | ||
#endif | ||
|
||
#ifndef BUILTIN_CONSTANT_EVAL | ||
#define BUILTIN_CONSTANT_EVAL() true | ||
#endif | ||
|
||
__device__ __host__ inline constexpr bool constant_eval() { | ||
return BUILTIN_CONSTANT_EVAL(); | ||
} | ||
|
||
int main(int, char**) { | ||
static_assert(constant_eval(), ""); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters