| 1 |
// RUN: %clang_cc1 -std=c++11 -fsyntax-only -fno-cuda-host-device-constexpr -verify %s |
| 2 |
// RUN: %clang_cc1 -std=c++11 -fsyntax-only -fno-cuda-host-device-constexpr -fcuda-is-device -verify %s |
| 3 |
|
| 4 |
#include "Inputs/cuda.h" |
| 5 |
|
| 6 |
// Check that, with -fno-cuda-host-device-constexpr, constexpr functions are |
| 7 |
// host-only, and __device__ constexpr functions are still device-only. |
| 8 |
|
| 9 |
constexpr int f() { return 0; } // expected-note {{not viable}} |
| 10 |
__device__ constexpr int g() { return 0; } // expected-note {{not viable}} |
| 11 |
|
| 12 |
void __device__ foo() { |
| 13 |
f(); // expected-error {{no matching function}} |
| 14 |
g(); |
| 15 |
} |
| 16 |
|
| 17 |
void __host__ foo() { |
| 18 |
f(); |
| 19 |
g(); // expected-error {{no matching function}} |
| 20 |
} |